Skip to content

Commit

Permalink
util function to strip and and phrases
Browse files Browse the repository at this point in the history
  • Loading branch information
adjscent committed Apr 21, 2019
1 parent 2aa90f7 commit 1d51335
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions QueryExpansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,19 @@ def convert_wordnet_terms(terms):

######################## UTIL FUNCTIONS ########################

def drop_AND_phrase(line):
"""
A really simple util function that strips out all bool and phrase markings
:param: line: Query string
"""
result = []
b1, b2, tokens = tokenize(line)
for token in tokens:
if token != AND:
for subtoken in token.split():
result.append(subtoken)
return convert_list_to_string(result)

def tokenize(line):
"""
Tokenises a line to a list of words, using the delimiter as space or ".
Expand Down

0 comments on commit 1d51335

Please sign in to comment.