Datasets:

ArXiv:
License:
File size: 1,543 Bytes
c574d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
/*

 * To change this template, choose Tools | Templates

 * and open the template in the editor.

 */
package tool.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import tool.Main;
import java.io.*;
/**

 *

 * @author

 */
public class Documents {
    
   
    public static List<DocumentConcepts> getDataSet() throws IOException {
        List<DocumentConcepts> dataset = new ArrayList<>();
        for (File file : Main.test_data_dir.listFiles()) {
            if (!file.toString().contains(".concept"))
                continue;            
            File textFile = new File(file.toString().replace(".concept", ".txt"));
            Abbreviation abbreviationObject = new Abbreviation();
            abbreviationObject.setTextAbbreviationExpansionMap(textFile);
            DocumentConcepts documentConceptsObject = new DocumentConcepts(textFile.getName(), Util.read(textFile));            
            try (BufferedReader br = new BufferedReader(new FileReader(file))) {
                String line;
                while ((line = br.readLine()) != null) {
                    line = line.trim();
                    String[] tokens = line.split("\\|\\|");
                    documentConceptsObject.setConcept(tokens, abbreviationObject);
                }
            }
            dataset.add(documentConceptsObject);
        }        
        return dataset;
    }    
    
}