https://github.com/buganini/bastpath
https://github.com/buganini/bastpath
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/buganini/bastpath
- Owner: buganini
- Created: 2022-12-10T08:34:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-11T10:21:37.000Z (over 3 years ago)
- Last Synced: 2025-05-15T23:12:39.030Z (about 1 year ago)
- Language: Python
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# XMLTaggedPOSSelector
A CSS-selector-like language for XML-Tagged POS querying
# How it works
Selector is converted to XPath (2.0 for regex function)
```
> python3 bastpath.py
a
//a
*
//*
a=b
//a[((string(.)="b"))]
a,b=c,'d',"e"
//*[((name()="a" or name()="b") and (string(.)="c" or string(.)="d" or string(.)="e"))]
a..=b
//*[((starts-with(name(), "a")) and (string(.)="b"))]
..a=b
//*[((ends-with(name(), "a")) and (string(.)="b"))]
..a..,b=c
//*[((contains(name(), "a") or name()="b") and (string(.)="c"))]
/x/i,b=c
//*[((matches(name(), "x", "i") or name()="b") and (string(.)="c"))]
a=..b
//a[((ends-with(string(.), "b")))]
..a=..b
//*[((ends-with(name(), "a")) and (ends-with(string(.), "b")))]
a=b..
//a[((starts-with(string(.), "b")))]
a=..b..
//a[((contains(string(.), "b")))]
a=!..b..
//a[((not(contains(string(.), "b"))))]
!a=b
//*[((name()!="a") and (string(.)="b"))]
a,b=c
//*[((name()="a" or name()="b") and (string(.)="c"))]
a b c
//a//b//c
a>b > c
//a/b/c
a b>b,c,!d, e
//a//b/*[((name()="b" or name()="c" or name()!="d" or name()="e"))]
a b=/x/
//a//b[((matches(string(.), "x")))]
a b=/'x"'/i
//a//b[((matches(string(.), concat("'","x"","'"), "i")))]
```