Skip to content

Translators has issues with quotations? #353

@tfnribeiro

Description

@tfnribeiro
2025-03-28 11:20:28 {'word': '‘duftsporet’', 'context': 'Det var i den forbindelse, at hun fik færten af ‘duftsporet’:', 'source_id': 390544, 'w_sent_i': 0, 'w_token_i': 11, 'w_total_tokens': 1, 'c_paragraph_i': 0, 'c_sent_i': 1, 'c_token_i': 0, 'left_ellipsis': False, 'right_ellipsis': False, 'context_identifier': {'context_type': 'ArticleFragment', 'article_fragment_id': 5713052, 'article_id': None, 'video_id': None}}

word_str = ‘duftsporet’ 
context = Det var i den forbindelse, at hun fik færten af ‘duftsporet’:

2025-03-28 11:20:28   File "/Zeeguu-API/zeeguu/api/endpoints/translation.py", line 69, in get_one_translation
2025-03-28 11:20:28     query = TranslationQuery.for_word_occurrence(word_str, context, 1, 7)
2025-03-28 11:20:28             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-28 11:20:28   File "/usr/local/lib/python3.12/site-packages/python_translators/translation_query.py", line 58, in for_word_occurrence
2025-03-28 11:20:28     result = re.search(rf"\b{query}\b", context).span()
2025-03-28 11:20:28              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-28 11:20:28 AttributeError: 'NoneType' object has no attribute 'span'

This is replicable in Production:

Image

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions