Hello :)
I have a project to do and it is almost done (i think), I just have some error.
Let me explain : I have 2 files. In the first file, there is something like a lexicon (with word and grammatical class) and in the second one a story (with word and grammatical class too). With these files, I have to find in the second file all the names, find a match in the lexicon and replace it by the seventh names after. It is call the S+7 method.
For now, I have 2 lists. The first one contain all the name in the lexicon and the second have all the words in the story.
For the processing I wrote this :
Thanks :)
PS : sorry for my bad english :p the variables are in french, to help you this is some informations :
- Listmot[] == list of all word in the story
- Listlexique[] == list of all name in the lexicon
- histoireResultat == output file
I have a project to do and it is almost done (i think), I just have some error.
Let me explain : I have 2 files. In the first file, there is something like a lexicon (with word and grammatical class) and in the second one a story (with word and grammatical class too). With these files, I have to find in the second file all the names, find a match in the lexicon and replace it by the seventh names after. It is call the S+7 method.
For now, I have 2 lists. The first one contain all the name in the lexicon and the second have all the words in the story.
For the processing I wrote this :
i = 0 j = 0 while i < len(Listmots)-1: if Listmots[i] in ListLexique: j = ListLexique.index(Listmots[i]) Listmots[i] = ListLexique[j+7] print(Listmots[i], end=" ", file=histoireResultat) i = i + 1 print(Listmots[i], end=" ", file=histoireResultat)Like I said before, it is almost done. The only problem is that in the output file, I have the "old" name AND the "new" name. I don't know how to deal with it. Can someone help me please ? :)
Thanks :)
PS : sorry for my bad english :p the variables are in french, to help you this is some informations :
- Listmot[] == list of all word in the story
- Listlexique[] == list of all name in the lexicon
- histoireResultat == output file