Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
v0.2 refine (parse_tagged corrected)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasoolims committed Feb 11, 2015
1 parent 0f926e0 commit a4b4a36
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
14 changes: 1 addition & 13 deletions Structures/Sentence.java
Expand Up @@ -5,6 +5,7 @@

package Structures;


import java.util.ArrayList;

public class Sentence implements Comparable {
Expand All @@ -18,14 +19,6 @@ public class Sentence implements Comparable {
private int[] brownCluster6thPrefix;
private int[] brownClusterFullString;

public Sentence(ArrayList<Integer> tokens, ArrayList<Integer> pos) {
words = new int[tokens.size()];
tags = new int[tokens.size()];
for (int i = 0; i < tokens.size(); i++) {
words[i] = tokens.get(i);
tags[i] = pos.get(i);
}
}

public Sentence(ArrayList<Integer> tokens, ArrayList<Integer> pos, ArrayList<Integer> brownCluster4thPrefix, ArrayList<Integer> brownCluster6thPrefix, ArrayList<Integer> brownClusterFullString) {
words = new int[tokens.size()];
Expand All @@ -42,11 +35,6 @@ public Sentence(ArrayList<Integer> tokens, ArrayList<Integer> pos, ArrayList<Int
}
}

public Sentence(int[] words, int[] tags) {
this.words = words;
this.tags = tags;
}

public int size() {
return words.length;
}
Expand Down
15 changes: 12 additions & 3 deletions TransitionBasedSystem/Parser/ParseTaggedThread.java
Expand Up @@ -49,7 +49,9 @@ public Pair<String, Integer> call() throws Exception {

ArrayList<Integer> tokens = new ArrayList<Integer>();
ArrayList<Integer> tags = new ArrayList<Integer>();

ArrayList<Integer> brownCluster4thPrefix=new ArrayList<Integer>();
ArrayList<Integer> brownCluster6thPrefix=new ArrayList<Integer>();
ArrayList<Integer> brownClusterFullString =new ArrayList<Integer>();

int i = 0;
for (String w : wrds) {
Expand All @@ -70,6 +72,10 @@ public Pair<String, Integer> call() throws Exception {
int pi = -1;
if (wordMap.containsKey(pos))
pi = wordMap.get(pos);
int[] clusters=maps.clusterId(word);
brownClusterFullString.add(clusters[0]);
brownCluster4thPrefix.add(clusters[1]);
brownCluster6thPrefix.add(clusters[2]);

tokens.add(wi);
tags.add(pi);
Expand All @@ -79,10 +85,13 @@ public Pair<String, Integer> call() throws Exception {
if (!rootFirst) {
tokens.add(0);
tags.add(0);
brownClusterFullString.add(0);
brownCluster4thPrefix.add(0);
brownCluster6thPrefix.add(0);
}
Sentence sentence = new Sentence(tokens, tags);
Configuration bestParse = parser.parse(sentence, rootFirst, beamWidth, 1);

Sentence sentence = new Sentence(tokens, tags,brownCluster4thPrefix,brownCluster6thPrefix,brownClusterFullString);
Configuration bestParse = parser.parse(sentence, rootFirst, beamWidth, 1);

StringBuilder finalOutput = new StringBuilder();
for (i = 0; i < words.length; i++) {
Expand Down
Binary file modified jar/YaraParser.jar
Binary file not shown.

0 comments on commit a4b4a36

Please sign in to comment.