• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Nested loops, debugging

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone!
I have some problems with a program I am writing.

Description of the program: I have a list of verbs (var all_verbs) and would like to compare them to a list elements that is in .gz file format("ex_v1.3.gz"). The ex_v1.3gz files looks like this:

word \t the dictionary form of the word \t morphological characteristics of the word
word1 \t the same dictionary form of the word \t morphological characteristics of the word
word2 \t the same dictionary form of the word \t morphological characteristics of the word
...
word \t the dictionary form of the word(not the same as above) \t morphological characteristics of the word
word1 \t the same dictionary form of the word \t morphological characteristics of the word
word2 \t the same dictionary form of the word \t morphological characteristics of the word
...

Now if a verb from svi_glagoli is equal to a dictionary form of the word from the .gz file then I want to find out what does the word form looks if its morphological characteristics are (for example: xy) and then write it in a .txt file. Here is an example (kinda hard with english because it isn't a proper flective language):
My verb is "to run". I want to write in the .txt "to run" and the form of this word that is used for third-person singular. The program now loops through the .gz file and find the line where the dictionary form is "to run", then looks for the morphological characteristics for third-person singular and then if everything matches writes the word form that is found in that line(i.e. runs)


I am not sure, that this method is logically a good one. I am pretty sure it's really slow (the .gz file is huge and it has to loop through it everytime). Anyway, it looks like this. In my previous topics, some people mentioned that my codes are unreadable, I hope it is better now.
My code:



In the code, this line.split("\t")[0] is the word, and line.split("\t")[2] == "xy" is the morphological characteristic.
My problem is that nothing happens. The verb.txt file is empty. If I test my program with a print() method it goeso n for some time then stops. Counted the loops in the nested loop = 6427709, in the outside loop = 3000 (The verbs list contains 3000 elements). The loop is working I guess, but it doesn't do anything.
Also, can you help me how to change this:



into something easier, a oneliner.

I know it is a long post, thank you, in advance, for your help.
 
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!