source/dataparsing/text_tagging.py
def mark_present_quotes(data, quote, if_quote_in_citation):
    """With a citation and a text, marks if it's in that text"""
    quote_in_data_startword = 0
    index = 0
    if_in_quote = False
    quote_list = word_tokenize(quote) #List of each word in quote
    #Find quote in data
    for word in data: #find() won't work, as data is in a different format
        if not if_in_quote:
            if word[0]==quote_list[0]:
                if_in_quote = True
                quote_in_data_startword = index
        else: #If we seem to be in a quote, check it's still true
            if len(quote_list)==(index-quote_in_data_startword): #Fully detected the quote
                for k in range(quote_in_data_startword, index, 1):
                    data[k][1] = 'quote'
                    data[k][2] = 'pass'
                if_in_quote = False
                quote_in_data_startword = 0
            elif word[0]!=quote_list[index-quote_in_data_startword]:
                if_in_quote = False
                quote_in_data_startword = 0
        index+=1
    return data
With a citation and a text, marks if it's in that text
With a citation and a text, marks if it's in that text
With a citation and a text marks if it ' s in that text
def mark_present_quotes(data, quote, if_quote_in_citation):
    quote_in_data_startword = 0
    index = 0
    if_in_quote = False
    quote_list = word_tokenize(quote) 
    for word in data: 
        if not if_in_quote:
            if word[0]==quote_list[0]:
                if_in_quote = True
                quote_in_data_startword = index
        else: 
            if len(quote_list)==(index-quote_in_data_startword): 
                for k in range(quote_in_data_startword, index, 1):
                    data[k][1] = 'quote'
                    data[k][2] = 'pass'
                if_in_quote = False
                quote_in_data_startword = 0
            elif word[0]!=quote_list[index-quote_in_data_startword]:
                if_in_quote = False
                quote_in_data_startword = 0
        index+=1
    return data
def mark_present_quotes ( data , quote , if_quote_in_citation ) : quote_in_data_startword = 0 index = 0 if_in_quote = False quote_list = word_tokenize ( quote ) for word in data : if not if_in_quote : if word [ 0 ] == quote_list [ 0 ] : if_in_quote = True quote_in_data_startword = index else : if len ( quote_list ) == ( index - quote_in_data_startword ) : for k in range ( quote_in_data_startword , index , 1 ) : data [ k ] [ 1 ] = 'quote' data [ k ] [ 2 ] = 'pass' if_in_quote = False quote_in_data_startword = 0 elif word [ 0 ] != quote_list [ index - quote_in_data_startword ] : if_in_quote = False quote_in_data_startword = 0 index += 1 return data
With a citation and a text, marks if it's in that text
With a citation and a text marks if it ' s in that text
"""With a citation and a text, marks if it's in that text""" #List of each word in quote #Find quote in data #find() won't work, as data is in a different format #If we seem to be in a quote, check it's still true #Fully detected the quote
data
quote
if_quote_in_citation