问题
In the stanford nlp, I used a pattern to match the phone number in regexner. But the NER is over writing it as Number.
If I remove the ner annotation then it is showing as PHONE_NUMBER. Can any one of you please help me.
Thanks in Advance.
Here is my regexner line:
^(?:(?:\+|0{0,2})91(\s*[\-]\s*)?|[0]?)?[789]\d{9}$ PHONENUMBER
回答1:
java command:
java -Xmx10g edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner -file phone-number-example.txt -outputFormat text -ner.fine.regexner.mapping phone-number-regex.rules
example text:
I will call him at 555-555-5555
format of rules file:
555-555-5555 PHONE_NUMBER NUMBER 1
(note the columns are tab delimited)
The fine-grained NER will be applied after the statistical NER. You can also build a custom regexner
and run it after the statistical model. The key is telling it to overwrite the NUMBER tag (which is indicated in the third column).
回答2:
^(?:(?:\+|0{0,2})91(\s*[\-]\s*)?|[0]?)?[789]\d{9}$ PHONENUMBER NUMBER
this worked the column after the CUSTOM NER column to overwrite
来源:https://stackoverflow.com/questions/50678418/ner-is-over-writing-the-custom-nerin-stanford-nlp