TEXT   10

label.txt

Guest on 23rd May 2021 08:06:06 AM

  1.                                 Label Matching
  2.  
  3. In the pattern tutorial, we expressed node labels as letters or perhaps words
  4. and assumed that if a pattern contains a letter or word, we searched exactly
  5. for that letter or word as the label of a node in a tree.  However, labels
  6. often have structure of their own and it is also often useful to match labels
  7. partially.  For example, when listing a filesystem, we'll often mask files
  8. whose names match some pattern.  If we search treebanks, where labels are
  9. much more richly structured, this becomes even more important.
  10.  
  11. Currently, strex comes with string label tests, substring tests, prefix tests,
  12. and regexp label tests.  You can set strex to use regexp labels in the file
  13. $STREX_HOME/conf/strex.properties, which contains more documentation on how
  14. to accomplish this.
  15.  
  16. One thing to keep in mind is when labels contain characters which are otherwise
  17. used in the tree structure pattern syntax, or maybe when a label contains white
  18. space.  In this case, you may surround a label with quotes.  For example,
  19.  
  20.                             /a/"some random text"/b
  21.  
  22. is a perfectly valid tree pattern.
  23.  
  24. Finally, you can negate label patterns by prepending a bang ("!"). For example,
  25. the pattern /!a/b  will match any tree with some label other than "a" as the
  26. root and with b as a child.

Raw Paste


Login or Register to edit or fork this paste. It's free.