Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I search a string in a very big file with a specific format in java?
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/5127640/do-searching-in-a-very-big-arpa-file-in-a-very-short-time-in-java">do searching in a very big ARPA file in a very short time in java</a> </p> </blockquote> <p>my file's format:</p> <p>\data\</p> <p>ngram 1=19</p> <p>ngram 2=234</p> <p>ngram 3=1013</p> <p>\1-grams:</p> <p>-1.7132 puluh -3.8008</p> <p>-1.9782 satu -3.8368</p> <p>\2-grams:</p> <p>-1.5403 dalam dua -1.0560</p> <p>-3.1626 dalam ini 0.0000</p> <p>\3-grams:</p> <p>-1.8726 itu dan tiga</p> <p>-1.9654 itu dan untuk</p> <p>\end\</p> <p>As you can see I have a number of lines in ngram 1,2 and 3. There is no need to read the whole file. If an input string is a one-word string, the program can just search in \1-grams: part. If an input string is a two-word string, the program can just search in \2-grams: part and so on. At last if the program finds the input string in the file, it has to return two numbers which are located at the left and right sides of the string. Also, I have to say that each part of the file has been sorted. I am sure that I do not have to read the file completely, and using the index file can not solve my problem. These ways take a lot of time, and my lecturer said that searching has to be done in less than 1 minute for such a big file. I think the best thing is to find a way to jump to a specific line not byte of the file, but I do not know how I can do it. It will be great if someone can help me to solve my problem.</p> <p>My file is almost 800MB. I have found that using BufferedReader is a good way to read a file very fast, but when I read such a big file and put it in an array line by line, it takes more than 30 minutes.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload