wroberts / nltk_tgrep Goto Github PK
View Code? Open in Web Editor NEWtgrep2 Searching for NLTK Trees
tgrep2 Searching for NLTK Trees
Documented in Section 4.8 of the tgrep2 manual.
Probably the only obstacle to getting this done is to remove the Unicode string literals in /nltk_tgrep/tests/test_tgrep.py.
The node name /SBJ/
should match nodes names SBJ
, SBJ1
, and NP-SBJ
. Currently, it doesn't match the last, because I'm using re.match
. This should be changed to re.search
.
Sections 4.6 and 4.7 of the tgrep2 manual.
This is implemented in _tgrep_node_action
, but is not defined in the search string grammar. Probably could be hacked by tweaking the regexp for node names, though perhaps this should be done properly, with a constant 'i@' prefix before, say node literal and node regexp values (so that one can't write i@*).
There is a commented-out test case for this.
Hi @wroberts, just wanted to say this tool is incredibly invaluable! Really a big time saver.
This question is more of a tgrep question, but I thought I might pose it here... I'm trying to develop a tregex for A with no children, or, in other words A as a leaf.
I've tried
"A < {}"
, "A !< *"
, and a few others...
Do you know how I can form this tregex or will I need to check the ParsedTree
for subtrees of size 0?
Node name quotation permits node names to contain quotes (these must be escaped with a backslash).
Currently, the code doesn't check for this, or perform un-escaping. The current code calls .strip('"')
, which is wrong.
Documented in section 4.9 of the tgrep2 manual.
,
'
See, e.g., first coveralls build
Hallo,
Your readme example won't work in NLTK 3.0.0
tree = ParentedTree('(S (NP (DT the) (JJ big) (NN dog)) (VP bit) (NP (DT a) (NN cat)))')
ParentedTree: Expected a node value and child list
This works, however:
tree = ParentedTree.fromstring('(S (NP (DT the) (JJ big) (NN dog)) (VP bit) (NP (DT a) (NN cat)))')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.