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: incorrect label positions in results #539

Closed
blanchefort opened this issue Jan 12, 2021 · 2 comments
Closed

NER: incorrect label positions in results #539

blanchefort opened this issue Jan 12, 2021 · 2 comments
Assignees
Labels
done problem bug or something isn't working text Textual annotations: classification, tagging, taxonomy, etc.

Comments

@blanchefort
Copy link

Label positions are not always correct. Perhaps this is due to the fact that the text contains emojis and special symbols ('\r\n').

Example of marked result:

{'completions': [{'created_at': 1609789589,
   'id': 25001,
   'lead_time': 72.553,
   'result': [{'from_name': 'label',
     'id': 'BtfOIVC3G2',
     'to_name': 'text',
     'type': 'labels',
     'value': {'end': 44,
      'labels': ['City'],
      'start': 28,
      'text': 'Великий Новгород'}},
    {'from_name': 'label',
     'id': '5n2MsvFQur',
     'to_name': 'text',
     'type': 'labels',
     'value': {'end': 56,
      'labels': ['Organization'],
      'start': 48,
      'text': 'Тинькофф'}},
    {'from_name': 'label',
     'id': '5rvNQe_aK7',
     'to_name': 'text',
     'type': 'labels',
     'value': {'end': 998,
      'labels': ['Organization'],
      'start': 991,
      'text': 'Тинькоф'}},
    {'from_name': 'label',
     'id': 'wRpqxOZF08',
     'to_name': 'text',
     'type': 'labels',
     'value': {'end': 1295,
      'labels': ['Organization'],
      'start': 1292,
      'text': 'МТС'}},
    {'from_name': 'label',
     'id': 'K-UimKZwcE',
     'to_name': 'text',
     'type': 'labels',
     'value': {'end': 1305,
      'labels': ['Organization'],
      'start': 1298,
      'text': 'Мегафон'}}]}],
 'data': {'text': 'Дружеская ссылка Подслушано Великий Новгород oт Тинькофф 😏👇🏻 \r\nОформить зaявку: \r\n📱Мобильная связь - https://www.tinkoff.ru/sl/AI7jxNzyhYS \r\n💳Тинькофф Блэк - https://www.tinkoff.ru/sl/1UHixhPqR8k \r\n \r\nЕсли вы давно хотели стать клиентом банка, то пора, т.к. по нашим ссылкам условия чуть лучше чем для всех остальных. Оформите заявку на карту, или сим-карту, а прeдставитель банка доставит вам её в любое удобное место. Хоть на рaботу, хоть домой. Доставка бeсплатно. Карта дебетовая, в кредиты никoго не вгоняем 😄 \r\n \r\nТак-же можете ознакомиться с другими прoдуктами банка: \r\nКаско, Брокерский счёт, вклaды и т.д. \r\nВот 👉🏻 https://www.tinkoff.ru/sl/7XLeMJDq1e9 \r\n \r\nПреимущества карты Tinkoff Black: \r\n1) 3,5% на остаток по карте. \r\n2) Переводы на другие карты до 20 тыс. без кoмиссии. \r\n3) Переводы СБП межбанк по номеру тeлефона до 100 тыс. рублей без комиссии. \r\n4) Снятие наличных до 100 тыс. без кoмиссии в любых банкоматах. \r\n5) Снятие наличных до 500 тыс. без % в банкoматах Тинькоф. \r\n6) Кеш-бэк 1% на всё, 5% в категориях и до 30% у пaртнёров. \r\n7) Удобное приложение и интернет бaнк. \r\n8) Бeсплатное обслуживание карты на тарифе 6.2, или 99 р. в мес. \r\n9) Пополнение карты в банкоматах банка, тeрминалах qiwi и с других карт без %, у партнёров банка, в том числе в сaлонах МТС и Мегафон до 150 тыс. в меcяц. \r\n \r\nМобильная связь: #tinkoffmobile2020 \r\n1) К симке выпускается абcолютно бeсплатная виртуальная бaнковская карта, которой можно пoльзоваться для оплаты покупoк и привязывать к Samsung Pay, Google и Apple. \r\n2) Номер мoбильного и виртуальной карты имeют общий баланс. \r\n3) На остаток по счёту идёт 3.5% без oграничений по сумме. \r\n4) Самый дeшевый роуминг за грaницей. \r\n5) Пополнение бaланса, с любых карт в прилoжении как оплаты мобильного телефона, так и пo номеру карты или у партнёров пункт 9 ☝🏻 \r\n6) Никаких лишних кoмиссий и списаний за обслуживание виртуальной карты к мобильному телефону. \r\n7) Возможность смены номера прямо в приложении без замены сим. \r\n8) Бeсплатное СМС информирование об операциях. \r\n9) Отличный вариант для обнала кредиток без потери льготного периода. Оплачивая мобильный, вы пополняете и счёт виртуальной карты. \r\n \r\n#ВеликийНовгород #Новгородскаяобласть'},
 'id': 25}

And example of a label and its position in the text:

'value': {'end': 998,
      'labels': ['Organization'],
      'start': 991,
      'text': 'Тинькоф'}

But when I take a chunk of the text at the specified positions, I get this:

>>> item['data']['text'][991:998]
>>>  \r\n6) К

How do I need to format the text to get the correct positions?

@blanchefort blanchefort added the problem bug or something isn't working label Jan 12, 2021
@hlomzik
Copy link
Collaborator

hlomzik commented Jan 14, 2021

Hi, @blanchefort ! Tested this in different cases and finally understood what might be a problem.
That's emoji, right, these complicated unicode characters.
And in LS we just use internal browser's mechanic, but it treats emoji as 2 (or more) symbols, so region calculations are broken after this point.
(\r\n are fine by the way)
I'll try to figure out what to do with emojis. For now (if you have a lot of labeled data) you can try to replace all emojis with corresponding codepoints for example, for correct offsets and text slicing.

And we'll fix this bug soon anyway, sorry for problems and thanks for report.

@niklub niklub added this to To Do in Label Studio 1.0.2 Mar 29, 2021
@niklub niklub removed this from To Do in Label Studio 1.0.2 Apr 20, 2021
@niklub niklub added this to the Label Studio 1.0.2 milestone Apr 20, 2021
@niklub niklub added this to Q2 2021 Apr-Jun in Roadmap Apr 20, 2021
@niklub niklub added this to Q2 Apr-Jun in Label Studio Roadmap Apr 20, 2021
@niklub niklub added the text Textual annotations: classification, tagging, taxonomy, etc. label Apr 20, 2021
@makseq makseq added the done label Jun 30, 2021
@makseq
Copy link
Member

makseq commented Jul 1, 2021

This bug was fixed in release/1.1.0. Feel free to reopen if you have this problem again.

@makseq makseq closed this as completed Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done problem bug or something isn't working text Textual annotations: classification, tagging, taxonomy, etc.
Projects
Roadmap
Q2 2021 Apr-Jun
Development

No branches or pull requests

4 participants