Пример #1
0
def searchName(word):
    """
    Check and search for a Name - Secondary Token

    :param word:
    :return: index inside names
    """
    return linearSearch(word, names)
Пример #2
0
def searchKeyWord(word):
    """
    Check and search if a word is a KeyWord - Primary Token

    HAS to be called for a Secondary Token to be created

    :param word:
    :return: index inside keyWordIds (primary token)
    """

    pos = linearSearch(word, keyWordIds)

    # If primary token does't exists and secondary is not created
    if pos == -1 and searchName(word) == -1:
        names.append(word)
        pos = Token.ID.value
    elif searchName(word) != -1 and word in names:
        pos = Token.ID.value
    return pos