4 ms·
On recent debians/ubuntu, PoS tagging is just one apt away: $ sudo apt install -y apertium-eng $ echo "I have been searching for a tool that can scan
by unhammer 6y ago
On recent debians/ubuntu, PoS tagging is just one apt away:
$ sudo apt install -y apertium-eng
$ echo "I have been searching for a tool that can scan a paragraph" |apertium eng-disam|grep -v '^;'
"<I>"
"prpers" prn subj p1 mf sg
"<have>"
"have" vbhaver inf
"have" vbhaver pres
"<been>"
"be" vbser pp
"<searching for>"
"search# for" vblex ger SELECT:177
"<a>"
"a" det ind sg
"<tool>"
"tool" n sg
"<that>"
"that" cnjsub
"that" prn dem mf sg
"that" prn rel an mf sp
"<can>"
"can" vbmod pres SELECT:281
"<scan>"
"scan" vblex inf SELECT:140
"<a>"
"a" det ind sg
"<paragraph>"
"paragraph" n sg
"<.>"
"." sent
(grepping out lines with ; since they just show what was not removed by the disambiguator, whereas SELECT/REMOVE are just trace info saying what rules applied. If there are multiple indented lines, then the disambiguator didn't manage to fully disambiguate the analysis.)
If you want to e.g. mark passive, it's easy to write a Constraint Grammar rule to do this. Put the following into rules.cg3:
DELIMITERS = sent ;
ADD (&PASSIVE) ("be") # Add the tag "&PASSIVE" to the word with lemma "be"
IF
(1* (pp) # There is a participle to the right
BARRIER (*) - (adv) # with nothing in between except perhaps adverbs
);
and pipe it in after the above pipeline:
$ echo "The paper is not signed by me" |apertium eng-disam |grep -v '^;'|vislcg3 -g rules.cg3
"<The>"
"the" det def sp
"<paper>"
"paper" n sg
"<is>"
"be" vbser pres p3 sg &PASSIVE
"<not>"
"not" adv
"<signed>"
"sign" vblex pp
"sign" vblex past
"signed" adj
"<by>"
"by" pr SELECT:470
"<me>"
"prpers" prn obj p1 mf sg
"<.>"
"." sent
( https://wiki.apertium.org/wiki/Constraint_Grammar https://wiki.apertium.org/wiki/Constraint_Grammar for more info on CG )
- Tainnor 6y agoThat rule is really rather limited. More in general, I doubt you can properly recognise passive constructions without doing constituent parsing, passive is really a syntactic construction, not a morphological one.
- unhammer 6y agoOr dependency parsing. But unfortunately the English package in Apertium doesn't have a syntax CG (there are proprietary English syntax CG's out there, with syntactic function labelling and dependency relations, while in Apertium there are syntax CG's for some other languages). OTOH, what's the goal? If you just want to flag some high-frequency constructions you can get quite far with very little depth.