Esempio n. 1
0
def parse_sent(s, IW):

	s = re.sub('\,', "", s)
	list_doc = s.split('.')

	# Eliminate blank sentences
	list_doc = [x for x in list_doc if len(x) is not 0]

	sentences = []
	sent_syllables = []

	for sent in list_doc:
		if sent == None:
			break
		l = sent.split()

		for word in l:
			if word == None:
				break
			if word.lower() in IW:
				syllables = syllabify.count_syllables(l)
				if syllables == None:
					break
				sentences.append(l)
				sent_syllables.append(syllables)
				break

	if len(sentences) < 3:
		# print('Error not enough sentences')
		return "ERROR", sent_syllables
	return (sentences,sent_syllables)
Esempio n. 2
0
def main():
    print_me = important_words.wordlist_string(
        "try this string of words try this string of important cat words however content president politicians are actually kind of important this is shit and it had better work",
        5)

    print print_me

    sentence = "72 This is my test sentence"

    s = sentence.split(' ')

    print s
    arrayct = syllabify.count_syllables(s)
    print arrayct

    sentence = "This is my test sentence"

    s = sentence.split(' ')

    print s
    arrayct = syllabify.count_syllables(s)
    print arrayct
Esempio n. 3
0
<<<<<<< HEAD
    list_doc = s.split('.')
=======
	s = re.sub('\,', "", s)
	list_doc = s.split('.')

>>>>>>> 8bfc2dbeaecb9af3bda874e36e85170718d60a26
	sentences = []
	sent_syllables = []
	for sent in list_doc:
		l = sent.split()

		for word in l:

			if word.lower() in IW:
				syllables = syllabify.count_syllables(l)
				if syllables == None:
					break
				sentences.append(l)
				sent_syllables.append(syllables)
				break

	if len(sentences) < 3:
		# print('Error not enough sentences')
		return None
	return (sentences,sent_syllables)


'''
raw = open('practice.txt').read()