Exemple #1
0
def buildtriplelemmasearchobject(pollid, one, two, three) -> SearchObject:
    """

	build a search object w/ three lemmata

	"""

    seeking = str()
    proximate = str()

    if not session['baggingmethod'] == 'unlemmatized':
        try:
            termone = lemmatadict[one]
            termtwo = lemmatadict[two]
            termthree = lemmatadict[three]
        except KeyError:
            termone = None
            termtwo = None
            termthree = None

        so = SearchObject(pollid, seeking, proximate, termone, termtwo,
                          session)
        so.lemmathree = termthree
    else:
        so = SearchObject(pollid, one, two, True, True, session)
        so.lemmathree = True
        so.termthree = so.searchtermcleanup(three)

    return so
Exemple #2
0
def buildsinglelemmasearchobject(pollid: str, one: str) -> SearchObject:
    """

	build a search object w/ one lemma

	"""
    try:
        lemma = lemmatadict[one]
    except KeyError:
        lemma = None

    seeking = str()
    proximate = str()
    proximatelemma = str()
    so = SearchObject(pollid, seeking, proximate, lemma, proximatelemma,
                      session)

    if so.session['baggingmethod'] == 'unlemmatized':
        so.seeking = so.searchtermcleanup(one)

    return so