mirror of
https://github.com/caperren/school_archives.git
synced 2025-11-09 21:51:15 +00:00
Added work from my other class repositories before deletion
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
def split_by_periods(document):
|
||||
output_array = []
|
||||
|
||||
sentence_array_temp = ""
|
||||
|
||||
for current_char in document:
|
||||
if current_char != "\n":
|
||||
sentence_array_temp += current_char
|
||||
|
||||
if current_char == ".":
|
||||
output_array.append(sentence_array_temp)
|
||||
sentence_array_temp = ""
|
||||
|
||||
if sentence_array_temp:
|
||||
output_array.append(sentence_array_temp)
|
||||
|
||||
return output_array
|
||||
|
||||
|
||||
def kwic(document, listPairs=False, ignoreWords=None, periodsToBreaks=False):
|
||||
if not document:
|
||||
return []
|
||||
|
||||
if periodsToBreaks:
|
||||
split_into_sentences = split_by_periods(document)
|
||||
else:
|
||||
split_into_sentences = document.splitlines()
|
||||
|
||||
return split_into_sentences
|
||||
Reference in New Issue
Block a user