File size: 1,076 Bytes
eff511c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from utils import normalize_for_search


AUTHORSHIP_TERMS = {
    "yazdi", "yazan", "yazilmis", "yazilmistir", "yazar",
    "yazari", "hazirladi", "hazirlandi", "hazirlayan",
    "hazirlanmis", "hazirlanmistir", "duzenleyen", "kaleme",
    "muellif",
}

AUTHORSHIP_CONTEXT_TERMS = {
    "kanun", "kanunu", "2547", "metin", "yasa", "yasayi",
}

KNOWN_FALSE_AUTHOR_TERMS = {
    "omer", "ilhan", "prof",
}


def is_unsupported_metadata_question(question: str) -> bool:
    """Detect source-external authorship/preparer questions that must not be guessed."""
    q = normalize_for_search(question)
    if not q:
        return False

    tokens = set(q.split())
    if tokens & KNOWN_FALSE_AUTHOR_TERMS:
        return True

    asks_person = "kim" in tokens or "kimin" in tokens or "kisi" in tokens or "kisinin" in tokens
    has_authorship = bool(tokens & AUTHORSHIP_TERMS) or "kaleme alan" in q or "tarafindan hazirlan" in q
    has_context = bool(tokens & AUTHORSHIP_CONTEXT_TERMS)

    return asks_person and has_authorship and has_context