grammar_cop 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.DS_Store +0 -0
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +8 -0
- data/data/.DS_Store +0 -0
- data/data/Makefile +511 -0
- data/data/Makefile.am +4 -0
- data/data/Makefile.in +511 -0
- data/data/de/.DS_Store +0 -0
- data/data/de/4.0.affix +7 -0
- data/data/de/4.0.dict +474 -0
- data/data/de/Makefile +387 -0
- data/data/de/Makefile.am +9 -0
- data/data/de/Makefile.in +387 -0
- data/data/en/.DS_Store +0 -0
- data/data/en/4.0.affix +26 -0
- data/data/en/4.0.batch +1002 -0
- data/data/en/4.0.biolg.batch +411 -0
- data/data/en/4.0.constituent-knowledge +127 -0
- data/data/en/4.0.dict +8759 -0
- data/data/en/4.0.dict.m4 +6928 -0
- data/data/en/4.0.enwiki.batch +14 -0
- data/data/en/4.0.fixes.batch +2776 -0
- data/data/en/4.0.knowledge +306 -0
- data/data/en/4.0.regex +225 -0
- data/data/en/4.0.voa.batch +114 -0
- data/data/en/Makefile +554 -0
- data/data/en/Makefile.am +19 -0
- data/data/en/Makefile.in +554 -0
- data/data/en/README +173 -0
- data/data/en/tiny.dict +157 -0
- data/data/en/words/.DS_Store +0 -0
- data/data/en/words/Makefile +456 -0
- data/data/en/words/Makefile.am +78 -0
- data/data/en/words/Makefile.in +456 -0
- data/data/en/words/currency +205 -0
- data/data/en/words/currency.p +28 -0
- data/data/en/words/entities.given-bisex.sing +39 -0
- data/data/en/words/entities.given-female.sing +4141 -0
- data/data/en/words/entities.given-male.sing +1633 -0
- data/data/en/words/entities.locations.sing +68 -0
- data/data/en/words/entities.national.sing +253 -0
- data/data/en/words/entities.organizations.sing +7 -0
- data/data/en/words/entities.us-states.sing +11 -0
- data/data/en/words/units.1 +45 -0
- data/data/en/words/units.1.dot +4 -0
- data/data/en/words/units.3 +2 -0
- data/data/en/words/units.4 +5 -0
- data/data/en/words/units.4.dot +1 -0
- data/data/en/words/words-medical.adv.1 +1191 -0
- data/data/en/words/words-medical.prep.1 +67 -0
- data/data/en/words/words-medical.v.4.1 +2835 -0
- data/data/en/words/words-medical.v.4.2 +2848 -0
- data/data/en/words/words-medical.v.4.3 +3011 -0
- data/data/en/words/words-medical.v.4.4 +3036 -0
- data/data/en/words/words-medical.v.4.5 +3050 -0
- data/data/en/words/words.adj.1 +6794 -0
- data/data/en/words/words.adj.2 +638 -0
- data/data/en/words/words.adj.3 +667 -0
- data/data/en/words/words.adv.1 +1573 -0
- data/data/en/words/words.adv.2 +67 -0
- data/data/en/words/words.adv.3 +157 -0
- data/data/en/words/words.adv.4 +80 -0
- data/data/en/words/words.n.1 +11464 -0
- data/data/en/words/words.n.1.wiki +264 -0
- data/data/en/words/words.n.2.s +2017 -0
- data/data/en/words/words.n.2.s.biolg +1 -0
- data/data/en/words/words.n.2.s.wiki +298 -0
- data/data/en/words/words.n.2.x +65 -0
- data/data/en/words/words.n.2.x.wiki +10 -0
- data/data/en/words/words.n.3 +5717 -0
- data/data/en/words/words.n.t +23 -0
- data/data/en/words/words.v.1.1 +1038 -0
- data/data/en/words/words.v.1.2 +1043 -0
- data/data/en/words/words.v.1.3 +1052 -0
- data/data/en/words/words.v.1.4 +1023 -0
- data/data/en/words/words.v.1.p +17 -0
- data/data/en/words/words.v.10.1 +14 -0
- data/data/en/words/words.v.10.2 +15 -0
- data/data/en/words/words.v.10.3 +88 -0
- data/data/en/words/words.v.10.4 +17 -0
- data/data/en/words/words.v.2.1 +1253 -0
- data/data/en/words/words.v.2.2 +1304 -0
- data/data/en/words/words.v.2.3 +1280 -0
- data/data/en/words/words.v.2.4 +1285 -0
- data/data/en/words/words.v.2.5 +1287 -0
- data/data/en/words/words.v.4.1 +2472 -0
- data/data/en/words/words.v.4.2 +2487 -0
- data/data/en/words/words.v.4.3 +2441 -0
- data/data/en/words/words.v.4.4 +2478 -0
- data/data/en/words/words.v.4.5 +2483 -0
- data/data/en/words/words.v.5.1 +98 -0
- data/data/en/words/words.v.5.2 +98 -0
- data/data/en/words/words.v.5.3 +103 -0
- data/data/en/words/words.v.5.4 +102 -0
- data/data/en/words/words.v.6.1 +388 -0
- data/data/en/words/words.v.6.2 +401 -0
- data/data/en/words/words.v.6.3 +397 -0
- data/data/en/words/words.v.6.4 +405 -0
- data/data/en/words/words.v.6.5 +401 -0
- data/data/en/words/words.v.8.1 +117 -0
- data/data/en/words/words.v.8.2 +118 -0
- data/data/en/words/words.v.8.3 +118 -0
- data/data/en/words/words.v.8.4 +119 -0
- data/data/en/words/words.v.8.5 +119 -0
- data/data/en/words/words.y +104 -0
- data/data/lt/.DS_Store +0 -0
- data/data/lt/4.0.affix +6 -0
- data/data/lt/4.0.constituent-knowledge +24 -0
- data/data/lt/4.0.dict +135 -0
- data/data/lt/4.0.knowledge +38 -0
- data/data/lt/Makefile +389 -0
- data/data/lt/Makefile.am +11 -0
- data/data/lt/Makefile.in +389 -0
- data/ext/.DS_Store +0 -0
- data/ext/link_grammar/.DS_Store +0 -0
- data/ext/link_grammar/extconf.rb +2 -0
- data/ext/link_grammar/link-grammar/.DS_Store +0 -0
- data/ext/link_grammar/link-grammar/.deps/analyze-linkage.Plo +198 -0
- data/ext/link_grammar/link-grammar/.deps/and.Plo +202 -0
- data/ext/link_grammar/link-grammar/.deps/api.Plo +244 -0
- data/ext/link_grammar/link-grammar/.deps/build-disjuncts.Plo +212 -0
- data/ext/link_grammar/link-grammar/.deps/command-line.Plo +201 -0
- data/ext/link_grammar/link-grammar/.deps/constituents.Plo +201 -0
- data/ext/link_grammar/link-grammar/.deps/count.Plo +202 -0
- data/ext/link_grammar/link-grammar/.deps/disjunct-utils.Plo +126 -0
- data/ext/link_grammar/link-grammar/.deps/disjuncts.Plo +123 -0
- data/ext/link_grammar/link-grammar/.deps/error.Plo +121 -0
- data/ext/link_grammar/link-grammar/.deps/expand.Plo +133 -0
- data/ext/link_grammar/link-grammar/.deps/extract-links.Plo +198 -0
- data/ext/link_grammar/link-grammar/.deps/fast-match.Plo +200 -0
- data/ext/link_grammar/link-grammar/.deps/idiom.Plo +200 -0
- data/ext/link_grammar/link-grammar/.deps/jni-client.Plo +217 -0
- data/ext/link_grammar/link-grammar/.deps/link-parser.Po +1 -0
- data/ext/link_grammar/link-grammar/.deps/massage.Plo +202 -0
- data/ext/link_grammar/link-grammar/.deps/post-process.Plo +202 -0
- data/ext/link_grammar/link-grammar/.deps/pp_knowledge.Plo +202 -0
- data/ext/link_grammar/link-grammar/.deps/pp_lexer.Plo +201 -0
- data/ext/link_grammar/link-grammar/.deps/pp_linkset.Plo +200 -0
- data/ext/link_grammar/link-grammar/.deps/prefix.Plo +102 -0
- data/ext/link_grammar/link-grammar/.deps/preparation.Plo +202 -0
- data/ext/link_grammar/link-grammar/.deps/print-util.Plo +200 -0
- data/ext/link_grammar/link-grammar/.deps/print.Plo +201 -0
- data/ext/link_grammar/link-grammar/.deps/prune.Plo +202 -0
- data/ext/link_grammar/link-grammar/.deps/read-dict.Plo +223 -0
- data/ext/link_grammar/link-grammar/.deps/read-regex.Plo +123 -0
- data/ext/link_grammar/link-grammar/.deps/regex-morph.Plo +131 -0
- data/ext/link_grammar/link-grammar/.deps/resources.Plo +203 -0
- data/ext/link_grammar/link-grammar/.deps/spellcheck-aspell.Plo +1 -0
- data/ext/link_grammar/link-grammar/.deps/spellcheck-hun.Plo +115 -0
- data/ext/link_grammar/link-grammar/.deps/string-set.Plo +198 -0
- data/ext/link_grammar/link-grammar/.deps/tokenize.Plo +160 -0
- data/ext/link_grammar/link-grammar/.deps/utilities.Plo +222 -0
- data/ext/link_grammar/link-grammar/.deps/word-file.Plo +201 -0
- data/ext/link_grammar/link-grammar/.deps/word-utils.Plo +212 -0
- data/ext/link_grammar/link-grammar/.libs/analyze-linkage.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/and.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/api.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/build-disjuncts.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/command-line.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/constituents.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/count.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/disjunct-utils.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/disjuncts.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/error.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/expand.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/extract-links.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/fast-match.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/idiom.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/jni-client.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java-symbols.expsym +31 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.4.dylib +0 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.4.dylib.dSYM/Contents/Info.plist +20 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.4.dylib.dSYM/Contents/Resources/DWARF/liblink-grammar-java.4.dylib +0 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.a +0 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.dylib +0 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar-symbols.expsym +194 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar.4.dylib +0 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar.4.dylib.dSYM/Contents/Info.plist +20 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar.4.dylib.dSYM/Contents/Resources/DWARF/liblink-grammar.4.dylib +0 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar.a +0 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar.dylib +0 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar.la +41 -0
- data/ext/link_grammar/link-grammar/.libs/liblink-grammar.lai +41 -0
- data/ext/link_grammar/link-grammar/.libs/massage.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/post-process.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/pp_knowledge.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/pp_lexer.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/pp_linkset.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/prefix.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/preparation.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/print-util.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/print.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/prune.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/read-dict.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/read-regex.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/regex-morph.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/resources.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/spellcheck-aspell.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/spellcheck-hun.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/string-set.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/tokenize.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/utilities.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/word-file.o +0 -0
- data/ext/link_grammar/link-grammar/.libs/word-utils.o +0 -0
- data/ext/link_grammar/link-grammar/Makefile +900 -0
- data/ext/link_grammar/link-grammar/Makefile.am +202 -0
- data/ext/link_grammar/link-grammar/Makefile.in +900 -0
- data/ext/link_grammar/link-grammar/analyze-linkage.c +1317 -0
- data/ext/link_grammar/link-grammar/analyze-linkage.h +24 -0
- data/ext/link_grammar/link-grammar/and.c +1603 -0
- data/ext/link_grammar/link-grammar/and.h +27 -0
- data/ext/link_grammar/link-grammar/api-structures.h +362 -0
- data/ext/link_grammar/link-grammar/api-types.h +72 -0
- data/ext/link_grammar/link-grammar/api.c +1887 -0
- data/ext/link_grammar/link-grammar/api.h +96 -0
- data/ext/link_grammar/link-grammar/autoit/.DS_Store +0 -0
- data/ext/link_grammar/link-grammar/autoit/README +10 -0
- data/ext/link_grammar/link-grammar/autoit/_LGTest.au3 +22 -0
- data/ext/link_grammar/link-grammar/autoit/_LinkGrammar.au3 +545 -0
- data/ext/link_grammar/link-grammar/build-disjuncts.c +487 -0
- data/ext/link_grammar/link-grammar/build-disjuncts.h +21 -0
- data/ext/link_grammar/link-grammar/command-line.c +458 -0
- data/ext/link_grammar/link-grammar/command-line.h +15 -0
- data/ext/link_grammar/link-grammar/constituents.c +1836 -0
- data/ext/link_grammar/link-grammar/constituents.h +26 -0
- data/ext/link_grammar/link-grammar/corpus/.DS_Store +0 -0
- data/ext/link_grammar/link-grammar/corpus/.deps/cluster.Plo +1 -0
- data/ext/link_grammar/link-grammar/corpus/.deps/corpus.Plo +1 -0
- data/ext/link_grammar/link-grammar/corpus/Makefile +527 -0
- data/ext/link_grammar/link-grammar/corpus/Makefile.am +46 -0
- data/ext/link_grammar/link-grammar/corpus/Makefile.in +527 -0
- data/ext/link_grammar/link-grammar/corpus/README +17 -0
- data/ext/link_grammar/link-grammar/corpus/cluster.c +286 -0
- data/ext/link_grammar/link-grammar/corpus/cluster.h +32 -0
- data/ext/link_grammar/link-grammar/corpus/corpus.c +483 -0
- data/ext/link_grammar/link-grammar/corpus/corpus.h +46 -0
- data/ext/link_grammar/link-grammar/count.c +828 -0
- data/ext/link_grammar/link-grammar/count.h +25 -0
- data/ext/link_grammar/link-grammar/disjunct-utils.c +261 -0
- data/ext/link_grammar/link-grammar/disjunct-utils.h +27 -0
- data/ext/link_grammar/link-grammar/disjuncts.c +138 -0
- data/ext/link_grammar/link-grammar/disjuncts.h +13 -0
- data/ext/link_grammar/link-grammar/error.c +92 -0
- data/ext/link_grammar/link-grammar/error.h +35 -0
- data/ext/link_grammar/link-grammar/expand.c +67 -0
- data/ext/link_grammar/link-grammar/expand.h +13 -0
- data/ext/link_grammar/link-grammar/externs.h +22 -0
- data/ext/link_grammar/link-grammar/extract-links.c +625 -0
- data/ext/link_grammar/link-grammar/extract-links.h +16 -0
- data/ext/link_grammar/link-grammar/fast-match.c +309 -0
- data/ext/link_grammar/link-grammar/fast-match.h +17 -0
- data/ext/link_grammar/link-grammar/idiom.c +373 -0
- data/ext/link_grammar/link-grammar/idiom.h +15 -0
- data/ext/link_grammar/link-grammar/jni-client.c +779 -0
- data/ext/link_grammar/link-grammar/jni-client.h +236 -0
- data/ext/link_grammar/link-grammar/liblink-grammar-java.la +42 -0
- data/ext/link_grammar/link-grammar/liblink-grammar.la +41 -0
- data/ext/link_grammar/link-grammar/link-features.h +37 -0
- data/ext/link_grammar/link-grammar/link-features.h.in +37 -0
- data/ext/link_grammar/link-grammar/link-grammar-java.def +31 -0
- data/ext/link_grammar/link-grammar/link-grammar.def +194 -0
- data/ext/link_grammar/link-grammar/link-includes.h +465 -0
- data/ext/link_grammar/link-grammar/link-parser.c +849 -0
- data/ext/link_grammar/link-grammar/massage.c +329 -0
- data/ext/link_grammar/link-grammar/massage.h +13 -0
- data/ext/link_grammar/link-grammar/post-process.c +1113 -0
- data/ext/link_grammar/link-grammar/post-process.h +45 -0
- data/ext/link_grammar/link-grammar/pp_knowledge.c +376 -0
- data/ext/link_grammar/link-grammar/pp_knowledge.h +14 -0
- data/ext/link_grammar/link-grammar/pp_lexer.c +1920 -0
- data/ext/link_grammar/link-grammar/pp_lexer.h +19 -0
- data/ext/link_grammar/link-grammar/pp_linkset.c +158 -0
- data/ext/link_grammar/link-grammar/pp_linkset.h +20 -0
- data/ext/link_grammar/link-grammar/prefix.c +482 -0
- data/ext/link_grammar/link-grammar/prefix.h +139 -0
- data/ext/link_grammar/link-grammar/preparation.c +412 -0
- data/ext/link_grammar/link-grammar/preparation.h +20 -0
- data/ext/link_grammar/link-grammar/print-util.c +87 -0
- data/ext/link_grammar/link-grammar/print-util.h +32 -0
- data/ext/link_grammar/link-grammar/print.c +1085 -0
- data/ext/link_grammar/link-grammar/print.h +16 -0
- data/ext/link_grammar/link-grammar/prune.c +1864 -0
- data/ext/link_grammar/link-grammar/prune.h +17 -0
- data/ext/link_grammar/link-grammar/read-dict.c +1785 -0
- data/ext/link_grammar/link-grammar/read-dict.h +29 -0
- data/ext/link_grammar/link-grammar/read-regex.c +161 -0
- data/ext/link_grammar/link-grammar/read-regex.h +12 -0
- data/ext/link_grammar/link-grammar/regex-morph.c +126 -0
- data/ext/link_grammar/link-grammar/regex-morph.h +17 -0
- data/ext/link_grammar/link-grammar/resources.c +180 -0
- data/ext/link_grammar/link-grammar/resources.h +23 -0
- data/ext/link_grammar/link-grammar/sat-solver/.DS_Store +0 -0
- data/ext/link_grammar/link-grammar/sat-solver/.deps/fast-sprintf.Plo +1 -0
- data/ext/link_grammar/link-grammar/sat-solver/.deps/sat-encoder.Plo +1 -0
- data/ext/link_grammar/link-grammar/sat-solver/.deps/util.Plo +1 -0
- data/ext/link_grammar/link-grammar/sat-solver/.deps/variables.Plo +1 -0
- data/ext/link_grammar/link-grammar/sat-solver/.deps/word-tag.Plo +1 -0
- data/ext/link_grammar/link-grammar/sat-solver/Makefile +527 -0
- data/ext/link_grammar/link-grammar/sat-solver/Makefile.am +29 -0
- data/ext/link_grammar/link-grammar/sat-solver/Makefile.in +527 -0
- data/ext/link_grammar/link-grammar/sat-solver/clock.hpp +33 -0
- data/ext/link_grammar/link-grammar/sat-solver/fast-sprintf.cpp +26 -0
- data/ext/link_grammar/link-grammar/sat-solver/fast-sprintf.hpp +7 -0
- data/ext/link_grammar/link-grammar/sat-solver/guiding.hpp +244 -0
- data/ext/link_grammar/link-grammar/sat-solver/matrix-ut.hpp +79 -0
- data/ext/link_grammar/link-grammar/sat-solver/sat-encoder.cpp +2811 -0
- data/ext/link_grammar/link-grammar/sat-solver/sat-encoder.h +11 -0
- data/ext/link_grammar/link-grammar/sat-solver/sat-encoder.hpp +381 -0
- data/ext/link_grammar/link-grammar/sat-solver/trie.hpp +118 -0
- data/ext/link_grammar/link-grammar/sat-solver/util.cpp +23 -0
- data/ext/link_grammar/link-grammar/sat-solver/util.hpp +14 -0
- data/ext/link_grammar/link-grammar/sat-solver/variables.cpp +5 -0
- data/ext/link_grammar/link-grammar/sat-solver/variables.hpp +829 -0
- data/ext/link_grammar/link-grammar/sat-solver/word-tag.cpp +159 -0
- data/ext/link_grammar/link-grammar/sat-solver/word-tag.hpp +162 -0
- data/ext/link_grammar/link-grammar/spellcheck-aspell.c +148 -0
- data/ext/link_grammar/link-grammar/spellcheck-hun.c +136 -0
- data/ext/link_grammar/link-grammar/spellcheck.h +34 -0
- data/ext/link_grammar/link-grammar/string-set.c +169 -0
- data/ext/link_grammar/link-grammar/string-set.h +16 -0
- data/ext/link_grammar/link-grammar/structures.h +498 -0
- data/ext/link_grammar/link-grammar/tokenize.c +1049 -0
- data/ext/link_grammar/link-grammar/tokenize.h +15 -0
- data/ext/link_grammar/link-grammar/utilities.c +847 -0
- data/ext/link_grammar/link-grammar/utilities.h +281 -0
- data/ext/link_grammar/link-grammar/word-file.c +124 -0
- data/ext/link_grammar/link-grammar/word-file.h +15 -0
- data/ext/link_grammar/link-grammar/word-utils.c +526 -0
- data/ext/link_grammar/link-grammar/word-utils.h +152 -0
- data/ext/link_grammar/link_grammar.c +202 -0
- data/ext/link_grammar/link_grammar.h +99 -0
- data/grammar_cop.gemspec +24 -0
- data/lib/.DS_Store +0 -0
- data/lib/grammar_cop.rb +9 -0
- data/lib/grammar_cop/.DS_Store +0 -0
- data/lib/grammar_cop/dictionary.rb +19 -0
- data/lib/grammar_cop/linkage.rb +30 -0
- data/lib/grammar_cop/parse_options.rb +32 -0
- data/lib/grammar_cop/sentence.rb +36 -0
- data/lib/grammar_cop/version.rb +3 -0
- data/test/.DS_Store +0 -0
- data/test/grammar_cop_test.rb +27 -0
- metadata +407 -0
@@ -0,0 +1,139 @@
|
|
1
|
+
/*
|
2
|
+
* BinReloc - a library for creating relocatable executables
|
3
|
+
* Written by: Mike Hearn <mike@theoretic.com>
|
4
|
+
* Hongli Lai <h.lai@chello.nl>
|
5
|
+
* http://autopackage.org/
|
6
|
+
*
|
7
|
+
* This source code is public domain. You can relicense this code
|
8
|
+
* under whatever license you want.
|
9
|
+
*
|
10
|
+
* See http://autopackage.org/docs/binreloc/ for
|
11
|
+
* more information and how to use this.
|
12
|
+
*
|
13
|
+
* NOTE: if you're using C++ and are getting "undefined reference
|
14
|
+
* to br_*", try renaming prefix.c to prefix.cpp
|
15
|
+
*/
|
16
|
+
|
17
|
+
#ifndef _PREFIX_H_
|
18
|
+
#define _PREFIX_H_
|
19
|
+
|
20
|
+
#ifdef __cplusplus
|
21
|
+
extern "C" {
|
22
|
+
#endif /* __cplusplus */
|
23
|
+
|
24
|
+
/* WARNING, BEFORE YOU MODIFY PREFIX.C:
|
25
|
+
*
|
26
|
+
* If you make changes to any of the functions in prefix.c, you MUST
|
27
|
+
* change the BR_NAMESPACE macro.
|
28
|
+
* This way you can avoid symbol table conflicts with other libraries
|
29
|
+
* that also happen to use BinReloc.
|
30
|
+
*
|
31
|
+
* Example:
|
32
|
+
* #define BR_NAMESPACE(funcName) foobar_ ## funcName
|
33
|
+
* --> expands br_locate to foobar_br_locate
|
34
|
+
*/
|
35
|
+
#undef BR_NAMESPACE
|
36
|
+
#define BR_NAMESPACE(funcName) funcName
|
37
|
+
|
38
|
+
|
39
|
+
#ifdef ENABLE_BINRELOC
|
40
|
+
|
41
|
+
#define br_thread_local_store BR_NAMESPACE(br_thread_local_store)
|
42
|
+
#define br_locate BR_NAMESPACE(br_locate)
|
43
|
+
#define br_locate_prefix BR_NAMESPACE(br_locate_prefix)
|
44
|
+
#define br_prepend_prefix BR_NAMESPACE(br_prepend_prefix)
|
45
|
+
|
46
|
+
#ifndef BR_NO_MACROS
|
47
|
+
/* These are convience macros that replace the ones usually used
|
48
|
+
in Autoconf/Automake projects */
|
49
|
+
#undef SELFPATH
|
50
|
+
#undef PREFIX
|
51
|
+
#undef PREFIXDIR
|
52
|
+
#undef BINDIR
|
53
|
+
#undef SBINDIR
|
54
|
+
#undef DATADIR
|
55
|
+
#undef LIBDIR
|
56
|
+
#undef LIBEXECDIR
|
57
|
+
#undef ETCDIR
|
58
|
+
#undef SYSCONFDIR
|
59
|
+
#undef CONFDIR
|
60
|
+
#undef LOCALEDIR
|
61
|
+
|
62
|
+
#define SELFPATH (br_thread_local_store (br_locate ((void *) "")))
|
63
|
+
#define PREFIX (br_thread_local_store (br_locate_prefix ((void *) "")))
|
64
|
+
#define PREFIXDIR (br_thread_local_store (br_locate_prefix ((void *) "")))
|
65
|
+
#define BINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/bin")))
|
66
|
+
#define SBINDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/sbin")))
|
67
|
+
#define DATADIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share")))
|
68
|
+
#define LIBDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/lib")))
|
69
|
+
#define LIBEXECDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/libexec")))
|
70
|
+
#define ETCDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
|
71
|
+
#define SYSCONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
|
72
|
+
#define CONFDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
|
73
|
+
#define LOCALEDIR (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/locale")))
|
74
|
+
#endif /* BR_NO_MACROS */
|
75
|
+
|
76
|
+
|
77
|
+
/* The following functions are used internally by BinReloc
|
78
|
+
and shouldn't be used directly in applications. */
|
79
|
+
|
80
|
+
char *br_locate (void *symbol);
|
81
|
+
char *br_locate_prefix (void *symbol);
|
82
|
+
char *br_prepend_prefix (void *symbol, char *path);
|
83
|
+
|
84
|
+
#endif /* ENABLE_BINRELOC */
|
85
|
+
|
86
|
+
const char *br_thread_local_store (char *str);
|
87
|
+
|
88
|
+
|
89
|
+
/* These macros and functions are not guarded by the ENABLE_BINRELOC
|
90
|
+
* macro because they are portable. You can use these functions.
|
91
|
+
*/
|
92
|
+
|
93
|
+
#define br_strcat BR_NAMESPACE(br_strcat)
|
94
|
+
#define br_extract_dir BR_NAMESPACE(br_extract_dir)
|
95
|
+
#define br_extract_prefix BR_NAMESPACE(br_extract_prefix)
|
96
|
+
#define br_set_locate_fallback_func BR_NAMESPACE(br_set_locate_fallback_func)
|
97
|
+
|
98
|
+
#ifndef BR_NO_MACROS
|
99
|
+
#ifndef ENABLE_BINRELOC
|
100
|
+
#define BR_SELFPATH(suffix) SELFPATH suffix
|
101
|
+
#define BR_PREFIX(suffix) PREFIX suffix
|
102
|
+
#define BR_PREFIXDIR(suffix) BR_PREFIX suffix
|
103
|
+
#define BR_BINDIR(suffix) BINDIR suffix
|
104
|
+
#define BR_SBINDIR(suffix) SBINDIR suffix
|
105
|
+
#define BR_DATADIR(suffix) DATADIR suffix
|
106
|
+
#define BR_LIBDIR(suffix) LIBDIR suffix
|
107
|
+
#define BR_LIBEXECDIR(suffix) LIBEXECDIR suffix
|
108
|
+
#define BR_ETCDIR(suffix) ETCDIR suffix
|
109
|
+
#define BR_SYSCONFDIR(suffix) SYSCONFDIR suffix
|
110
|
+
#define BR_CONFDIR(suffix) CONFDIR suffix
|
111
|
+
#define BR_LOCALEDIR(suffix) LOCALEDIR suffix
|
112
|
+
#else
|
113
|
+
#define BR_SELFPATH(suffix) (br_thread_local_store (br_strcat (SELFPATH, suffix)))
|
114
|
+
#define BR_PREFIX(suffix) (br_thread_local_store (br_strcat (PREFIX, suffix)))
|
115
|
+
#define BR_PREFIXDIR(suffix) (br_thread_local_store (br_strcat (BR_PREFIX, suffix)))
|
116
|
+
#define BR_BINDIR(suffix) (br_thread_local_store (br_strcat (BINDIR, suffix)))
|
117
|
+
#define BR_SBINDIR(suffix) (br_thread_local_store (br_strcat (SBINDIR, suffix)))
|
118
|
+
#define BR_DATADIR(suffix) (br_thread_local_store (br_strcat (DATADIR, suffix)))
|
119
|
+
#define BR_LIBDIR(suffix) (br_thread_local_store (br_strcat (LIBDIR, suffix)))
|
120
|
+
#define BR_LIBEXECDIR(suffix) (br_thread_local_store (br_strcat (LIBEXECDIR, suffix)))
|
121
|
+
#define BR_ETCDIR(suffix) (br_thread_local_store (br_strcat (ETCDIR, suffix)))
|
122
|
+
#define BR_SYSCONFDIR(suffix) (br_thread_local_store (br_strcat (SYSCONFDIR, suffix)))
|
123
|
+
#define BR_CONFDIR(suffix) (br_thread_local_store (br_strcat (CONFDIR, suffix)))
|
124
|
+
#define BR_LOCALEDIR(suffix) (br_thread_local_store (br_strcat (LOCALEDIR, suffix)))
|
125
|
+
#endif
|
126
|
+
#endif
|
127
|
+
|
128
|
+
char *br_strcat (const char *str1, const char *str2);
|
129
|
+
char *br_extract_dir (const char *path);
|
130
|
+
char *br_extract_prefix(const char *path);
|
131
|
+
typedef char *(*br_locate_fallback_func) (void *symbol, void *data);
|
132
|
+
void br_set_locate_fallback_func (br_locate_fallback_func func, void *data);
|
133
|
+
|
134
|
+
|
135
|
+
#ifdef __cplusplus
|
136
|
+
}
|
137
|
+
#endif /* __cplusplus */
|
138
|
+
|
139
|
+
#endif /* _PREFIX_H_ */
|
@@ -0,0 +1,412 @@
|
|
1
|
+
/*************************************************************************/
|
2
|
+
/* Copyright (c) 2004 */
|
3
|
+
/* Daniel Sleator, David Temperley, and John Lafferty */
|
4
|
+
/* All rights reserved */
|
5
|
+
/* */
|
6
|
+
/* Use of the link grammar parsing system is subject to the terms of the */
|
7
|
+
/* license set forth in the LICENSE file included with this software, */
|
8
|
+
/* and also available at http://www.link.cs.cmu.edu/link/license.html */
|
9
|
+
/* This license allows free redistribution and use in source and binary */
|
10
|
+
/* forms, with or without modification, subject to certain conditions. */
|
11
|
+
/* */
|
12
|
+
/*************************************************************************/
|
13
|
+
|
14
|
+
#include "api.h"
|
15
|
+
#include "disjunct-utils.h"
|
16
|
+
|
17
|
+
void free_deletable(Sentence sent)
|
18
|
+
{
|
19
|
+
int w;
|
20
|
+
if (sent->dptr != NULL)
|
21
|
+
{
|
22
|
+
for (w = 0; w <= sent->length; w++)
|
23
|
+
{
|
24
|
+
xfree((char *)sent->dptr[w], sizeof(char) * (sent->length + 1));
|
25
|
+
}
|
26
|
+
xfree((char *) sent->dptr, (sent->length + 1)*sizeof(char *));
|
27
|
+
sent->dptr = NULL;
|
28
|
+
sent->deletable = NULL;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Returns true if the range lw...rw inclusive contains a conjunction
|
34
|
+
*/
|
35
|
+
static int conj_in_range(Sentence sent, int lw, int rw)
|
36
|
+
{
|
37
|
+
for (;lw < rw+1; lw++) {
|
38
|
+
if (sent->is_conjunction[lw]) return TRUE;
|
39
|
+
}
|
40
|
+
return FALSE;
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Initialize the array deletable[i][j] to indicate if the words
|
45
|
+
* i+1...j-1 could be non existant in one of the multiple linkages. This
|
46
|
+
* array is used in conjunction_prune and power_prune. Regions of length
|
47
|
+
* 0 are always deletable. A region of length two with a conjunction at
|
48
|
+
* one end is always deletable. Another observation is that for the
|
49
|
+
* comma to form the right end of a deletable region, it must be the case
|
50
|
+
* that there is a conjunction to the right of the comma. Also, when
|
51
|
+
* considering deletable regions with a comma on their left sides, there
|
52
|
+
* must be a conjunction inside the region to be deleted. Finally, the
|
53
|
+
* words "either", "neither", "both", "not" and "not only" are all
|
54
|
+
* deletable.
|
55
|
+
*/
|
56
|
+
void build_deletable(Sentence sent, int has_conjunction)
|
57
|
+
{
|
58
|
+
int i,j,k;
|
59
|
+
|
60
|
+
free_deletable(sent);
|
61
|
+
|
62
|
+
sent->dptr = (char **) xalloc((sent->length + 1) * sizeof(char *));
|
63
|
+
sent->deletable = sent->dptr + 1; /* we need to be able to access the [-1] position in this array */
|
64
|
+
|
65
|
+
for (i = -1; i<sent->length; i++)
|
66
|
+
{
|
67
|
+
sent->deletable[i] = (char *) xalloc((sent->length+1) * sizeof(char));
|
68
|
+
/* the +1 is to allow us to have the info for the last word
|
69
|
+
read the comment above */
|
70
|
+
for (j=0; j<= sent->length; j++)
|
71
|
+
{
|
72
|
+
if (j == i+1)
|
73
|
+
{
|
74
|
+
sent->deletable[i][j] = TRUE;
|
75
|
+
}
|
76
|
+
else if (sent->null_links)
|
77
|
+
{
|
78
|
+
sent->deletable[i][j] = TRUE;
|
79
|
+
}
|
80
|
+
else if (!has_conjunction)
|
81
|
+
{
|
82
|
+
sent->deletable[i][j] = FALSE;
|
83
|
+
}
|
84
|
+
else if ((j > i + 2) && (sent->is_conjunction[i+1] ||
|
85
|
+
sent->is_conjunction[j-1] ||
|
86
|
+
(strcmp(",", sent->word[i+1].string) == 0 &&
|
87
|
+
conj_in_range(sent, i+2, j-1)) ||
|
88
|
+
(strcmp(",",sent->word[j-1].string) == 0 &&
|
89
|
+
conj_in_range(sent, j, sent->length - 1))))
|
90
|
+
{
|
91
|
+
sent->deletable[i][j] = TRUE;
|
92
|
+
}
|
93
|
+
else if (j > i)
|
94
|
+
{
|
95
|
+
for (k=i+1; k<j; k++)
|
96
|
+
{
|
97
|
+
if ((strcmp("either", sent->word[k].string) == 0) ||
|
98
|
+
(strcmp("neither", sent->word[k].string) == 0) ||
|
99
|
+
(strcmp("both", sent->word[k].string) == 0) ||
|
100
|
+
(strcmp("not", sent->word[k].string) == 0)) continue;
|
101
|
+
if ((strcmp("only", sent->word[k].string)==0) && (k > i+1) &&
|
102
|
+
(strcmp("not", sent->word[k-1].string)==0)) continue;
|
103
|
+
break;
|
104
|
+
}
|
105
|
+
sent->deletable[i][j] = (k == j);
|
106
|
+
}
|
107
|
+
else
|
108
|
+
{
|
109
|
+
sent->deletable[i][j] = FALSE;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
void free_effective_dist(Sentence sent)
|
116
|
+
{
|
117
|
+
int w;
|
118
|
+
if (sent->effective_dist != NULL) {
|
119
|
+
for (w=0; w<sent->length; w++) {
|
120
|
+
xfree((char *)sent->effective_dist[w],sizeof(char)*(sent->length+1));
|
121
|
+
}
|
122
|
+
xfree((char *) sent->effective_dist, sizeof(char *)*(sent->length));
|
123
|
+
sent->effective_dist = NULL;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* The "effective distance" between two words is the actual distance minus
|
129
|
+
* the largest deletable region strictly between the two words. If the
|
130
|
+
* effective distance between two words is greater than a connector's max
|
131
|
+
* link length, then that connector cannot be satisfied by linking these
|
132
|
+
* two words.
|
133
|
+
*
|
134
|
+
* [Note: The effective distance is not monotically increasing as you move
|
135
|
+
* away from a word.]
|
136
|
+
*
|
137
|
+
* This function creates effective_dist[][]. It assumes that deleteble[][]
|
138
|
+
* has already been computed.
|
139
|
+
*
|
140
|
+
* Dynamic programming is used to compute this. The order used is smallest
|
141
|
+
* region to largest.
|
142
|
+
*
|
143
|
+
* Just as deletable[i][j] is constructed for j=N_words (which is one
|
144
|
+
* off the end of the sentence) we do that for effective_dist[][].
|
145
|
+
*/
|
146
|
+
void build_effective_dist(Sentence sent, int has_conjunction)
|
147
|
+
{
|
148
|
+
int i, j, diff;
|
149
|
+
|
150
|
+
free_effective_dist(sent);
|
151
|
+
sent->effective_dist = (char **) xalloc((sent->length)*sizeof(char *));
|
152
|
+
|
153
|
+
for (i=0; i<sent->length; i++) {
|
154
|
+
sent->effective_dist[i] = (char *) xalloc(sent->length+1);
|
155
|
+
}
|
156
|
+
for (i=0; i<sent->length; i++) {
|
157
|
+
/* Fill in the silly part */
|
158
|
+
for (j=0; j<=i; j++) {
|
159
|
+
sent->effective_dist[i][j] = j-i;
|
160
|
+
}
|
161
|
+
}
|
162
|
+
|
163
|
+
/* what is the rationale for ignoring the effective_dist
|
164
|
+
if null links are allowed? */
|
165
|
+
if (sent->null_links) {
|
166
|
+
for (i=0; i<sent->length; i++) {
|
167
|
+
for (j=0; j<=sent->length; j++) {
|
168
|
+
sent->effective_dist[i][j] = j-i;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
else {
|
173
|
+
for (diff = 1; diff < sent->length; diff++) {
|
174
|
+
for (i=0; i+diff <= sent->length; i++) {
|
175
|
+
j = i+diff;
|
176
|
+
if (sent->deletable[i][j]) { /* note that deletable[x][x+1] is TRUE */
|
177
|
+
sent->effective_dist[i][j] = 1;
|
178
|
+
} else {
|
179
|
+
sent->effective_dist[i][j] = 1 + MIN(sent->effective_dist[i][j-1],sent->effective_dist[i+1][j]);
|
180
|
+
}
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
/* now when you link to a conjunction, your effective length is 1 */
|
185
|
+
|
186
|
+
for (i=0; i<sent->length; i++) {
|
187
|
+
for (j=i+1; j<sent->length; j++) {
|
188
|
+
if (sent->is_conjunction[i] ||
|
189
|
+
sent->is_conjunction[j]) sent->effective_dist[i][j] = 1;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
/* sent->effective_dist[i][i] should be 0 */
|
195
|
+
|
196
|
+
/*
|
197
|
+
for (j=0; j<=sent->length; j++) {
|
198
|
+
printf("%4d", j);
|
199
|
+
}
|
200
|
+
printf("\n");
|
201
|
+
for (i=0; i<sent->length; i++) {
|
202
|
+
for (j=0; j<=sent->length; j++) {
|
203
|
+
printf("%4d", sent->effective_dist[i][j]);
|
204
|
+
}
|
205
|
+
printf("\n");
|
206
|
+
}
|
207
|
+
*/
|
208
|
+
}
|
209
|
+
|
210
|
+
/**
|
211
|
+
* Installs all the special fat disjuncts on all of the words of the
|
212
|
+
* sentence
|
213
|
+
*/
|
214
|
+
void install_fat_connectors(Sentence sent)
|
215
|
+
{
|
216
|
+
int i;
|
217
|
+
for (i=0; i<sent->length; i++) {
|
218
|
+
if (sent->is_conjunction[i]) {
|
219
|
+
sent->word[i].d = catenate_disjuncts(sent->word[i].d,
|
220
|
+
build_AND_disjunct_list(sent, sent->word[i].string));
|
221
|
+
} else {
|
222
|
+
sent->word[i].d = catenate_disjuncts(sent->word[i].d,
|
223
|
+
explode_disjunct_list(sent, sent->word[i].d));
|
224
|
+
if (strcmp(sent->word[i].string, ",") == 0) {
|
225
|
+
sent->word[i].d = catenate_disjuncts(sent->word[i].d,
|
226
|
+
build_COMMA_disjunct_list(sent));
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
static void
|
233
|
+
set_connector_list_length_limit(Sentence sent,
|
234
|
+
Connector *c,
|
235
|
+
Connector_set *conset,
|
236
|
+
int short_len,
|
237
|
+
Parse_Options opts)
|
238
|
+
{
|
239
|
+
for (; c!=NULL; c=c->next) {
|
240
|
+
if (parse_options_get_all_short_connectors(opts)) {
|
241
|
+
c->length_limit = short_len;
|
242
|
+
}
|
243
|
+
else if (conset == NULL || match_in_connector_set(sent, conset, c, '+')) {
|
244
|
+
c->length_limit = UNLIMITED_LEN;
|
245
|
+
} else {
|
246
|
+
c->length_limit = short_len;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
static void set_connector_length_limits(Sentence sent, Parse_Options opts)
|
252
|
+
{
|
253
|
+
int i;
|
254
|
+
int len;
|
255
|
+
Disjunct *d;
|
256
|
+
|
257
|
+
len = opts->short_length;
|
258
|
+
if (len > UNLIMITED_LEN) len = UNLIMITED_LEN;
|
259
|
+
|
260
|
+
for (i=0; i<sent->length; i++) {
|
261
|
+
for (d = sent->word[i].d; d != NULL; d = d->next) {
|
262
|
+
set_connector_list_length_limit(sent, d->left, sent->dict->unlimited_connector_set, len, opts);
|
263
|
+
set_connector_list_length_limit(sent, d->right, sent->dict->unlimited_connector_set, len, opts);
|
264
|
+
}
|
265
|
+
}
|
266
|
+
}
|
267
|
+
|
268
|
+
void free_sentence_expressions(Sentence sent)
|
269
|
+
{
|
270
|
+
int i;
|
271
|
+
for (i=0; i<sent->length; i++) {
|
272
|
+
free_X_nodes(sent->word[i].x);
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
|
277
|
+
/**
|
278
|
+
* Return true if the sentence contains a conjunction. Assumes
|
279
|
+
* is_conjunction[] has been initialized.
|
280
|
+
*
|
281
|
+
* This routine has been added to the public API as of version 4.7.0,
|
282
|
+
* as it is required to determine whether a fat linkage might restult
|
283
|
+
* during parsing. This is needed to optimize the optioanl use of fat
|
284
|
+
* links. The goal is to eventually deprecate fat linkages entirely;
|
285
|
+
* this routine is needed in the transition phase.
|
286
|
+
*/
|
287
|
+
int sentence_contains_conjunction(Sentence sent)
|
288
|
+
{
|
289
|
+
int w;
|
290
|
+
if (NULL == sent->is_conjunction) return FALSE;
|
291
|
+
|
292
|
+
for (w=0; w<sent->length; w++) {
|
293
|
+
if (sent->is_conjunction[w]) return TRUE;
|
294
|
+
}
|
295
|
+
return FALSE;
|
296
|
+
}
|
297
|
+
|
298
|
+
void free_sentence_disjuncts(Sentence sent)
|
299
|
+
{
|
300
|
+
int i;
|
301
|
+
|
302
|
+
for (i=0; i<sent->length; ++i) {
|
303
|
+
free_disjuncts(sent->word[i].d);
|
304
|
+
sent->word[i].d = NULL;
|
305
|
+
}
|
306
|
+
if (sentence_contains_conjunction(sent)) free_AND_tables(sent);
|
307
|
+
}
|
308
|
+
|
309
|
+
|
310
|
+
/**
|
311
|
+
* Assumes that the sentence expression lists have been generated.
|
312
|
+
* This does all the necessary pruning and building of fat-link structures.
|
313
|
+
*/
|
314
|
+
void prepare_to_parse(Sentence sent, Parse_Options opts)
|
315
|
+
{
|
316
|
+
int i, has_conjunction;
|
317
|
+
|
318
|
+
build_sentence_disjuncts(sent, opts->disjunct_cost);
|
319
|
+
if (verbosity > 2) {
|
320
|
+
printf("After expanding expressions into disjuncts:");
|
321
|
+
print_disjunct_counts(sent);
|
322
|
+
}
|
323
|
+
print_time(opts, "Built disjuncts");
|
324
|
+
|
325
|
+
for (i=0; i<sent->length; i++) {
|
326
|
+
sent->word[i].d = eliminate_duplicate_disjuncts(sent->word[i].d);
|
327
|
+
}
|
328
|
+
print_time(opts, "Eliminated duplicate disjuncts");
|
329
|
+
|
330
|
+
if (verbosity > 2) {
|
331
|
+
printf("\nAfter expression pruning and duplicate elimination:\n");
|
332
|
+
print_disjunct_counts(sent);
|
333
|
+
}
|
334
|
+
|
335
|
+
sent->null_links = (opts->min_null_count > 0);
|
336
|
+
|
337
|
+
if (opts->use_fat_links)
|
338
|
+
{
|
339
|
+
has_conjunction = sentence_contains_conjunction(sent);
|
340
|
+
}
|
341
|
+
else
|
342
|
+
{
|
343
|
+
has_conjunction = FALSE;
|
344
|
+
}
|
345
|
+
|
346
|
+
/* The deletable region depends on whether null links are in use;
|
347
|
+
* with null_links everything is deletable. Thus, this processing
|
348
|
+
* cannot be done earlier than here.
|
349
|
+
*/
|
350
|
+
set_connector_length_limits(sent, opts);
|
351
|
+
build_deletable(sent, has_conjunction);
|
352
|
+
build_effective_dist(sent, has_conjunction);
|
353
|
+
init_count(sent);
|
354
|
+
|
355
|
+
if (!has_conjunction) {
|
356
|
+
pp_and_power_prune(sent, RUTHLESS, opts);
|
357
|
+
} else {
|
358
|
+
pp_and_power_prune(sent, GENTLE, opts);
|
359
|
+
/*
|
360
|
+
if (verbosity > 2) {
|
361
|
+
printf("\nAfter Gentle power pruning:\n");
|
362
|
+
print_disjunct_counts(sent);
|
363
|
+
}
|
364
|
+
*/
|
365
|
+
/* already reported -- print_time(opts, "Finished gentle power pruning"); */
|
366
|
+
conjunction_prune(sent, opts);
|
367
|
+
if (verbosity > 2) {
|
368
|
+
printf("\nAfter conjunction pruning:\n");
|
369
|
+
print_disjunct_counts(sent);
|
370
|
+
}
|
371
|
+
print_time(opts, "Done conjunction pruning");
|
372
|
+
build_conjunction_tables(sent);
|
373
|
+
install_fat_connectors(sent);
|
374
|
+
install_special_conjunctive_connectors(sent);
|
375
|
+
if (verbosity > 2) {
|
376
|
+
printf("After conjunctions, disjuncts counts:\n");
|
377
|
+
print_disjunct_counts(sent);
|
378
|
+
}
|
379
|
+
set_connector_length_limits(sent, opts);
|
380
|
+
/* have to do this again cause of the
|
381
|
+
* new fat connectors and disjuncts */
|
382
|
+
|
383
|
+
print_time(opts, "Constructed fat disjuncts");
|
384
|
+
|
385
|
+
prune(sent);
|
386
|
+
print_time(opts, "Pruned fat disjuncts");
|
387
|
+
|
388
|
+
for (i=0; i<sent->length; i++) {
|
389
|
+
sent->word[i].d = eliminate_duplicate_disjuncts(sent->word[i].d);
|
390
|
+
}
|
391
|
+
if (verbosity > 2) {
|
392
|
+
printf("After pruning and duplicate elimination:\n");
|
393
|
+
print_disjunct_counts(sent);
|
394
|
+
}
|
395
|
+
print_time(opts, "Eliminated duplicate disjuncts (again)");
|
396
|
+
|
397
|
+
if (verbosity > 2) print_AND_statistics(sent);
|
398
|
+
|
399
|
+
power_prune(sent, RUTHLESS, opts);
|
400
|
+
}
|
401
|
+
free_count(sent);
|
402
|
+
|
403
|
+
/*
|
404
|
+
if (verbosity > 2) {
|
405
|
+
printf("\nAfter RUTHLESS power-pruning:\n");
|
406
|
+
print_disjunct_counts(sent);
|
407
|
+
}
|
408
|
+
*/
|
409
|
+
/* print time for power pruning used to be here */
|
410
|
+
/* now done in power_prune itself */
|
411
|
+
print_time(opts, "Initialized fast matcher and hash table");
|
412
|
+
}
|