nkjp.py
495 Bytes
import poliqarp
import settings
def exists(query):
print query
query = query.replace(',', '[orth=","]')
settings.NKJP_CONNECTION.make_query(query)
settings.NKJP_CONNECTION.run_query(1)
if settings.NKJP_CONNECTION.get_n_spotted_results() > 0:
print 'tak'
return True
print 'nie'
return False
def connect(corpus_path):
connection = poliqarp.Connection()
connection.make_session()
connection.open_corpus(corpus_path)
return connection