Esempio n. 1
0
def drive():
#def main(f):

	# Calculate important words - returns array of important words
	#important = important_words.wordlist_string(text_input, 10)

	# Get sentences with words
	# INPUT VERSION
	# f = sys.stdin.readline()

	# FILE IO VERSION
	# print f
	f = open('practice2.txt').read()

	important_word = important_words.wordlist_string(f,10)
	print (important_word)
	important_sentences, counts = sent_parser.parse_sent(f, important_word)
	print (important_sentences)
	offsets = haiku_algorithm.find_haiku(counts)
	
	lines = find_lines.get_lines(offsets, important_sentences, important_word)
	
	for i in lines:
		if len(i)==0:
			print ('None')
			#return None

	output = ''
	for i in lines:
		line = ' '.join([str(x) for x in i])
		output += line + '\n'

	print (output)
	
	return output
Esempio n. 2
0
def drive():
    #def main(f):

    # Calculate important words - returns array of important words
    #important = important_words.wordlist_string(text_input, 10)

    # Get sentences with words
    # INPUT VERSION
    # f = sys.stdin.readline()

    # FILE IO VERSION
    # print f
    f = open('practice2.txt').read()

    important_word = important_words.wordlist_string(f, 10)
    print(important_word)
    important_sentences, counts = sent_parser.parse_sent(f, important_word)
    print(important_sentences)
    offsets = haiku_algorithm.find_haiku(counts)

    lines = find_lines.get_lines(offsets, important_sentences, important_word)

    for i in lines:
        if len(i) == 0:
            print('None')
            #return None

    output = ''
    for i in lines:
        line = ' '.join([str(x) for x in i])
        output += line + '\n'

    print(output)

    return output
Esempio n. 3
0
def drive():
    #def main(f):

    # Calculate important words - returns array of important words
    #important = important_words.wordlist_string(text_input, 10)

    # Get sentences with words
    # INPUT VERSION
    f = sys.stdin.readline()
    if len(f) < 5:
        print('')
        return None

    important_word = important_words.wordlist_string(f, 10)

    # Remove NoneType from list
    important_word = [x for x in important_word if x is not None]

    important_sentences, counts = sent_parser.parse_sent(f, important_word)
    if important_sentences == "ERROR":
        print('')
        return None

    offsets = haiku_algorithm.find_haiku(counts)

    lines = find_lines.get_lines(offsets, important_sentences, important_word)

    for i in lines:
        if len(i) == 0:
            print('')
            return None

    output = ''
    for i in lines:
        line = ' '.join([str(x) for x in i])
        output += line + ' * '

    print(output)

    return output
Esempio n. 4
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. 5
0
def drive():
#def main(f):

	# Calculate important words - returns array of important words
	f = open('practice2.txt').read()

	important_word = important_words.wordlist_string(f,10)
	print important_word

	# Remove NoneType from list
	important_word = [x for x in important_word if x is not None]

	print important_word

	important_sentences, counts = sent_parser.parse_sent(f, important_word)
	if important_sentences == "ERROR":
		print ('None')
		
	print (important_sentences)
	offsets = haiku_algorithm.find_haiku(counts)
	
	lines = find_lines.get_lines(offsets, important_sentences, important_word)
	
	for i in lines:
		if len(i)==0:
			print ('None')
			#return None

	output = ''
	for i in lines:
		line = ' '.join([str(x) for x in i])
		output += line + '\n'

	print (output)
	
	return output