For this project I would like to create a program that extracts the verbs from a text and create a circle with them.

My experience with programming is still in its beginning.  To explain my feelings about it I would use the analogy of a  1 year old girl that is starting to talk, knows the words buy still is not able to create sentences, or stammers the first ones.  Its hard to explain the feeling, but it is still hard to me to talk.

Here the instructions for the program :

First

  • Open a txt  that has all the verbs on it separated by ” , “
  • Check all the words of the input text and see if they match with any of the words of the verbs.txt
  • if they match: create a list with that verbs.

Second

  • with that list of “Verbs from the input text”: #the circle will have 12 lines.
  • select randomly one with 5 letters and print it after  4 spaces. Skip a line.
  • select one randomly one with 6 letters and print it after 3 spaces. Skip a line.
  • select one randomly one with 8 letters and print it after 2 spaces. Skip a line.  If there is not any verb with 8 letters, select 2 verbs.
  • select one randomly one with 9 letters and print it after 1 spaces. Skip a line.   If there is not any verb with 9 letters, select 2 verbs.
  • select one randomly one with 10 letters and print it after 1 spaces. Skip a line.  If there is not any verb with 10 letters, select 2 verbs.
  • select one randomly one with 11 letters and print it after 0 spaces. Skip a line.  If there is not any verb with 11 letters, select 2 verbs.
  • select one randomly one with 12 letters and print it after 0 spaces. Skip a line.  If there is not any verb with 12 letters, select 2 verbs.
  • select one randomly one with 11 letters and print it after 1 spaces. Skip a line.  If there is not any verb with 11 letters, select 2 verbs.
  • select one randomly one with 9 letters and print it after 1 spaces. Skip a line.   If there is not any verb with 9 letters, select 2 verbs.
  • select one randomly one with 8 letters and print it after 2 spaces. Skip a line.  If there is not any verb with 8 letters, select 2 verbs.
  • select one randomly one with 6 letters and print it after 3 spaces. Skip a line.
  • select randomly one with 5 letters and print it after  4 spaces. Skip a line.

I started creating 2 programs.

1 for the shape and one for the verbs instructions.

thecircle.py

space_1= ” ”
space_2= ” ”
space_4= ” ”
space_6= ” ”
space_9= ” ”
space_12=” ”
print space_12,”Verb6l”
print space_9,”Verb12leters”
print space_6,”Verb18letterssssss”
print space_4,”Verb22letterssssssssss”
print space_2,”verb26lettersssssssssssss”
print space_1,”verb28lettersssssssssssssss”
print space_1,”verb28lettersssssssssssssss”
print space_2,”verb26lettersssssssssssss”
print space_4,”Verb22letterssssssssss”
print space_6,”Verb18letterssssss”
print space_9,”Verb12leters”
print space_12,”verb6l”

 

verbs_circle.py

import sys
import random
#open list of irregular verbs
irregular_verbs = list()
for line in open(‘irregular_verbs.txt’):
line = line.strip()
irregular_verbs.extend(line.split(“,”))
#print irregular_verbs

#Create a list of the words of the input text
OriginalText= list()
for line in open(‘Ezra Pound _ what is money for.txt’):
OriginalText.extend(line.split(” “))

#Check all the words of the input text and
#see if they match with any of the words of irregular_verbs.txt
#if they match: create a list of verbsInText.
verbsInText= list()
for word in OriginalText:
if len(word) > 0 and word in irregular_verbs:
verbsInText.append(word)
#return verbsInText
print verbsInText
verbsInText.sort(key=lambda s: len(s))
space_1= ” ”
space_2= ” ”
space_4= ” ”
newString= “”
for verb in verbsInText:
newString+=verb + space_2

print newString

#create a variable to make random choice from the list of verbs of OriginalText
random_verbs = random.choice(verbsInText)
#print
print ” “.join(verbsInText)

I still have the challenge of:

  1. use the library for the verbs list.
  2. create a shape with the verbs.