1   package eu.fbk.dh.tint.inverse.digimorph.annotator;
2   
3   import org.mapdb.SortedTableMap;
4   
5   import java.util.LinkedList;
6   import java.util.List;
7   import java.util.concurrent.Callable;
8   
9   /**
10   * Created by giovannimoretti on 31/01/17.
11   */
12  
13  public class InverseDigiMorph_Analizer implements Callable<List<String>> {
14  
15      // Volume volume = null;
16      private SortedTableMap<String, String> map = null;
17  
18      List<String> morphos;
19  
20      public InverseDigiMorph_Analizer(List<String> morphos, SortedTableMap<String, String> map) {
21          this.morphos = morphos;
22          this.map = map;
23      }
24  
25      public List<String> call() {
26          List<String> results = new LinkedList<String>();
27          for (String s : this.morphos) {
28              results.add(getInverseMorphology(s));
29          }
30          return results;
31      }
32  
33      public String getInverseMorphology(String morpho) {
34  
35  
36          String output = "";
37          String form = map.get((morpho));
38          output = form != null ? form : morpho.split("\\+")[0];
39          return output.trim();
40  
41  
42      }
43  
44  
45  
46  }