ozzem
ozzem

Reputation: 294

Stanford core nlp - using ner and RegexNER - regexNER wins over ner if overlapped

I'm using Stanford core nlp for named entities recognition. I found a problem using regexp and ner togheter.

this is my sentence :

mi chiamo Vincenzo Monaco ** translate of "my name is Vincenzo Monaco"

Ner found correctly "vincenzo monaco" as "NAME" regexner found "monaco" like a city

and the output, for the request at http://localhost:9009/?properties={"annotators":"ner,regexner","outputFormat":"json"}

{
"sentences": [
    {
        "index": 0,
        "tokens": [
            {
                "index": 1,
                "word": "mi",
                "originalText": "mi",
                "lemma": "mi",
                "characterOffsetBegin": 0,
                "characterOffsetEnd": 2,
                "pos": "O",
                "ner": "O"
            },
            {
                "index": 2,
                "word": "chiamo",
                "originalText": "chiamo",
                "lemma": "chiamo",
                "characterOffsetBegin": 3,
                "characterOffsetEnd": 9,
                "pos": "O",
                "ner": "O"
            },
            {
                "index": 3,
                "word": "vincenzo",
                "originalText": "vincenzo",
                "lemma": "vincenzo",
                "characterOffsetBegin": 10,
                "characterOffsetEnd": 18,
                "pos": "O",
                "ner": "NAME"
            },
            {
                "index": 4,
                "word": "monaco",
                "originalText": "monaco",
                "lemma": "monaco",
                "characterOffsetBegin": 19,
                "characterOffsetEnd": 25,
                "pos": "O",
                "ner": "CITY"
            }
        ]
    }
]

}

if I make a request at http://localhost:9009/?properties={"annotators":"ner","outputFormat":"json"} (without the regexp) it answer correctly :

{
"sentences": [
    {
        "index": 0,
        "tokens": [
            {
                "index": 1,
                "word": "mi",
                "originalText": "mi",
                "lemma": "mi",
                "characterOffsetBegin": 0,
                "characterOffsetEnd": 2,
                "pos": "O",
                "ner": "O"
            },
            {
                "index": 2,
                "word": "chiamo",
                "originalText": "chiamo",
                "lemma": "chiamo",
                "characterOffsetBegin": 3,
                "characterOffsetEnd": 9,
                "pos": "O",
                "ner": "O"
            },
            {
                "index": 3,
                "word": "vincenzo",
                "originalText": "vincenzo",
                "lemma": "vincenzo",
                "characterOffsetBegin": 10,
                "characterOffsetEnd": 18,
                "pos": "O",
                "ner": "NAME"
            },
            {
                "index": 4,
                "word": "monaco",
                "originalText": "monaco",
                "lemma": "monaco",
                "characterOffsetBegin": 19,
                "characterOffsetEnd": 25,
                "pos": "O",
                "ner": "NAME"
            }
        ]
    }
]

}

I read something about put ner before regexner but never change as you can see and the same inverting the order.

Upvotes: 0

Views: 176

Answers (1)

monaco\tperson\tcity

Make you regexner line similar to the above line
and in your properties file write the following
ner.fine.regexner.mapping=/path of custom regexner file

Upvotes: 0

Related Questions