summaryrefslogtreecommitdiff
path: root/src/main/Main.java
blob: 81b6df915cf85d9210d53d7be288469440612ea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Scanner;

/**
 * The main class containing the main method.
 *
 * @author Maurice Laveaux
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    
    /**
     * TODO: parametrized query
     * choose query
     * choose filters (analyzor)
    */
    
       
public static void main(String[] args) throws FileNotFoundException {
        HashMap<String, Double> unimap = new HashMap<String, Double>(); // Map for uni
        HashMap<String, Double> bimap = new HashMap<String, Double>(); // Map for bi
        
        File uniFile = new File("unigrams-pmilexicon.txt"); // scan uni
        Scanner uniScanner = new Scanner(uniFile);
        File biFile = new File("bigrams-pmilexicon.txt"); // scan bi
        Scanner biScanner = new Scanner(biFile);
        
        while (uniScanner.hasNext()) { // Set up map with uni
            unimap.put(uniScanner.next(), Double.parseDouble(uniScanner.next()));
            if (uniScanner.hasNextLine()) {
                uniScanner.nextLine();
            }
        }

        while (biScanner.hasNext()) { // Set up map with bi
            bimap.put(biScanner.next() + " " + biScanner.next(), Double.parseDouble(biScanner.next()));
            if (biScanner.hasNextLine()) {
                biScanner.nextLine();
            }
        }
    }

}