Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NER is failing on Turkish keywords #151

Open
ne0c0de opened this issue Feb 28, 2019 · 0 comments
Open

NER is failing on Turkish keywords #151

ne0c0de opened this issue Feb 28, 2019 · 0 comments

Comments

@ne0c0de
Copy link

ne0c0de commented Feb 28, 2019

Describe the bug
Named entity recognizer is failing on Turkish keywords even on 1/1 matching

To Reproduce

const { NerManager } = require('node-nlp');
const manager = new NerManager({ threshold: 0.5 });

manager.addNamedEntityText(
  'entity',
  "Sağlık",
  ['tr'],
  ["ilaç"]
);

manager.addNamedEntityText(
  'currency',
  'currency',
  ['tr'],
  ["türk lira", "lira", "₺", "tl", "tele", "dolar", "usd", "$", "euro", "avro", "yuro", "oyro", "€", "usd", "eur", "gbp", "jpy", "cnh", "aud", "dkk", "sek", "chf", "cad", "kwd", "nok", "sar"],
);

const entity = manager.addNamedEntity('amount', 'regex');
entity.addRegex('tr', /\b([0-9]+(?:[\.\,][0-9]{1,3})?)\s*(t+[ÜüUu]*r+[KkQq]+\ +l+[Iİıi1]*r+[Aa@4]+|l+[Iİıi1]*r+[Aa@4]+(?:[^\s]*)|\₺+|t+l+|t+[Ee€]*l+[Ee€]+|d+[OÖoö]*l+[Aa@4]*r+|[ÜüUu]+[SsŞş]+d+|\$+|[Ee€]+[ÜüUu]*r+[OÖoö]+|[Aa@4]+[vVwW]+r+[OÖoö]+|y+[ÜüUu]*r+[OÖoö]+|[OÖoö]+y+r+[OÖoö]+|\€+|[ÜüUu]+[SsŞş]+d+|[Ee€]+[ÜüUu]*r+|[ĞğGg]+[Bbß]+p+|j+p+y+|[ÇçCc¢]+n+h+|[Aa@4]+[ÜüUu]*d+|d+[KkQq]+[KkQq]+|[SsŞş]+[Ee€]*[KkQq]+|[ÇçCc¢]+h+f+|[ÇçCc¢]+[Aa@4]*d+|[KkQq]+[vVwW]+d+|n+[OÖoö]*[KkQq]+|[SsŞş]+[Aa@4]*r+)\b/gi);

manager.findEntities(
  '10 tl ilaç',
  'tr',
).then(entities => {
  console.log(entities);
});

Expected behavior
it should find "ilaç" keyword with %100 matching but it's getting it with %75

Here's the result of the above lines:

[ { start: 6,
    end: 8,
    len: 3,
    levenshtein: 1,
    accuracy: 0.75,
    option: 'Sağlık',
    sourceText: 'ilaç',
    entity: 'entity',
    utteranceText: 'ila' },
  { start: 3,
    end: 4,
    len: 2,
    levenshtein: 0,
    accuracy: 1,
    option: 'currency',
    sourceText: 'tl',
    entity: 'currency',
    utteranceText: 'tl' },
  { start: 0,
    end: 5,
    accuracy: 1,
    sourceText: '10 tl',
    utteranceText: '10 tl',
    entity: 'amount' } ]

Desktop (please complete the following information):

  • Version Current latest version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant