Skip to content

Commit

Permalink
adding new labels for form and sense models #26
Browse files Browse the repository at this point in the history
  • Loading branch information
MedKhem committed Jul 11, 2018
1 parent 3aad906 commit 8c03904
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 14 deletions.
12 changes: 10 additions & 2 deletions src/main/java/org/grobid/core/engines/FormParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,17 @@ private void produceXmlNode(StringBuilder buffer, String clusterContent, String
buffer.append(createMyXMLString("gramGrp", clusterContent));
} else if (tagLabel.equals(LANG_LABEL)) {
buffer.append(createMyXMLString("lang", clusterContent));
} else if (tagLabel.equals(DICTIONARY_DICTSCRAP_LABEL)) {
} else if (tagLabel.equals(PERSNAME_FROM_LABEL)) {
buffer.append(createMyXMLString("persName", clusterContent));
}else if (tagLabel.equals(SURNAME_FROM_LABEL)) {
buffer.append(createMyXMLString("surName", clusterContent));
}else if (tagLabel.equals(ADDNAME_FROM_LABEL)) {
buffer.append(createMyXMLString("addName", clusterContent));
}else if (tagLabel.equals(DESC_FROM_LABEL)) {
buffer.append(createMyXMLString("desc", clusterContent));
} else if (tagLabel.equals(DICTSCRAP_FORM_LABEL)) {
buffer.append(createMyXMLString("dictScrap", clusterContent));
} else {
}else {
throw new IllegalArgumentException(tagLabel + " is not a valid possible tag");
}
}
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/org/grobid/core/engines/SenseParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,19 @@ private void produceXmlNode(StringBuilder buffer, String clusterContent, String
clusterContent = DocumentUtils.escapeHTMLCharac(clusterContent);


if (tagLabel.equals(SenseLabels.SENSE_SENSE)) {
if (tagLabel.equals(SenseLabels.SENSE_SENSE_LABEL)) {
buffer.append(createMyXMLString("sense", clusterContent));
} else if (tagLabel.equals(SenseLabels.SENSE_GRAMMATICAL_GROUP)) {
} else if (tagLabel.equals(SenseLabels.GRAMMATICAL_GROUP_SENSE_LABEL)) {
buffer.append(createMyXMLString("gramGrp", clusterContent));
} else if (tagLabel.equals(DictionaryBodySegmentationLabels.PUNCTUATION_LABEL)) {
} else if (tagLabel.equals(SenseLabels.PC_SENSE_LABEL)) {
buffer.append(createMyXMLString("pc", clusterContent));
} else if (tagLabel.equals(LexicalEntryLabels.LEXICAL_ENTRY_OTHER_LABEL)) {
} else if (tagLabel.equals(SenseLabels.DEF_SENSE_LABEL)) {
buffer.append(createMyXMLString("def", clusterContent));
} else if (tagLabel.equals(SenseLabels.NOTE_SENSE_LABEL)) {
buffer.append(createMyXMLString("note", clusterContent));
} else if (tagLabel.equals(SenseLabels.CIT_SENSE_LABEL)) {
buffer.append(createMyXMLString("cit", clusterContent));
} else if (tagLabel.equals(SenseLabels.DICTSCRAP_SENSE_LABEL)) {
buffer.append(createMyXMLString("dictScrap", clusterContent));
} else {
throw new IllegalArgumentException(tagLabel + " is not a valid possible tag");
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/org/grobid/core/engines/label/FormLabels.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,34 @@ private FormLabels() {
public static final String PRONUNCIATION_FORM_LABEL = "<pron>";
public static final String GRAMMATICAL_GROUP_FORM_LABEL = "<gramGrp>";
public static final String LANG_LABEL = "<lang>";
public static final String DICTIONARY_DICTSCRAP_LABEL = "<dictScrap>";
public static final String PERSNAME_FROM_LABEL= "<persName>";
public static final String SURNAME_FROM_LABEL= "<surName>";
public static final String ADDNAME_FROM_LABEL= "<addName>";
public static final String DESC_FROM_LABEL= "<desc>";
public static final String DICTSCRAP_FORM_LABEL = "<dictScrap>";
public static final String PC_FORM_LABEL = "<pc>";
public static final TaggingLabel FORM_ORTHOGRAPHY = new TaggingLabelImpl(DictionaryModels.FORM, ORTHOGRAPHY_FORM_LABEL);
public static final TaggingLabel FORM_PRONUNCIATION = new TaggingLabelImpl(DictionaryModels.FORM, PRONUNCIATION_FORM_LABEL);
public static final TaggingLabel FORM_GRAMMATICAL_GROUP = new TaggingLabelImpl(DictionaryModels.FORM, GRAMMATICAL_GROUP_FORM_LABEL);
public static final TaggingLabel FORM_LANG = new TaggingLabelImpl(DictionaryModels.FORM, LANG_LABEL);
public static final TaggingLabel FORM_OTHER = new TaggingLabelImpl(DictionaryModels.FORM, DICTIONARY_DICTSCRAP_LABEL);
public static final TaggingLabel FORM_PUNCTUATION = new TaggingLabelImpl(DictionaryModels.FORM, PUNCTUATION_LABEL);
public static final TaggingLabel FORM_PERSNAME = new TaggingLabelImpl(DictionaryModels.FORM, PERSNAME_FROM_LABEL);
public static final TaggingLabel FORM_SURNAME = new TaggingLabelImpl(DictionaryModels.FORM, SURNAME_FROM_LABEL);
public static final TaggingLabel FORM_ADDNAME = new TaggingLabelImpl(DictionaryModels.FORM, ADDNAME_FROM_LABEL);
public static final TaggingLabel FORM_DESC = new TaggingLabelImpl(DictionaryModels.FORM, DESC_FROM_LABEL);
public static final TaggingLabel FORM_DICTSCRAP = new TaggingLabelImpl(DictionaryModels.FORM, DICTSCRAP_FORM_LABEL);
public static final TaggingLabel FORM_PUNCTUATION = new TaggingLabelImpl(DictionaryModels.FORM, PC_FORM_LABEL);

static {
register(FORM_ORTHOGRAPHY);
register(FORM_PRONUNCIATION);
register(FORM_GRAMMATICAL_GROUP);
register(FORM_LANG);
register(FORM_PUNCTUATION);
register(FORM_OTHER);
register(FORM_DICTSCRAP);
register(FORM_PERSNAME);
register(FORM_SURNAME);
register(FORM_ADDNAME);
register(FORM_DESC);
}

}
24 changes: 20 additions & 4 deletions src/main/java/org/grobid/core/engines/label/SenseLabels.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,32 @@ public class SenseLabels extends TaggingLabels {
private SenseLabels() {
super();
}
public static final String DICTIONARY_DICTSCRAP_LABEL = "<dictScrap>";
public static final String SENSE_SENSE_LABEL = "<sense>";
public static final String DEF_SENSE_LABEL = "<def>";
public static final String NOTE_SENSE_LABEL = "<note>";
public static final String CIT_SENSE_LABEL = "<cit>";
public static final String GRAMMATICAL_GROUP_SENSE_LABEL = "<gramGrp>";
public static final String DICTSCRAP_SENSE_LABEL = "<dictScrap>";
public static final String PC_SENSE_LABEL = "<pc>";

public static final TaggingLabel SENSE_SENSE = new TaggingLabelImpl(DictionaryModels.SENSE, SENSE_SENSE_LABEL);
public static final TaggingLabel SENSE_DEF = new TaggingLabelImpl(DictionaryModels.SENSE, DEF_SENSE_LABEL);
public static final TaggingLabel SENSE_NOTE = new TaggingLabelImpl(DictionaryModels.SENSE, NOTE_SENSE_LABEL);
public static final TaggingLabel SENSE_CIT = new TaggingLabelImpl(DictionaryModels.SENSE, CIT_SENSE_LABEL);
public static final TaggingLabel SENSE_GRAMMATICAL_GROUP = new TaggingLabelImpl(DictionaryModels.SENSE, GRAMMATICAL_GROUP_SENSE_LABEL);
public static final TaggingLabel SENSE_DICTSCRAP = new TaggingLabelImpl(DictionaryModels.SENSE, DICTSCRAP_SENSE_LABEL);
public static final TaggingLabel SENSE_PC = new TaggingLabelImpl(DictionaryModels.SENSE, PC_SENSE_LABEL);


public static final TaggingLabel SENSE_DICTSCRAP = new TaggingLabelImpl(DictionaryModels.SENSE, DICTIONARY_DICTSCRAP_LABEL);
public static final TaggingLabel SENSE_GRAMMATICAL_GROUP = new TaggingLabelImpl(DictionaryModels.SENSE, LEXICAL_ENTRY_SENSE_LABEL);

public static final TaggingLabel SENSE_SENSE = new TaggingLabelImpl(DictionaryModels.SENSE, LEXICAL_ENTRY_SENSE_LABEL);
static {
register(SENSE_SENSE);
register(SENSE_DEF);
register(SENSE_NOTE);
register(SENSE_CIT);
register(SENSE_GRAMMATICAL_GROUP);
register(SENSE_DICTSCRAP);
register(SENSE_PC);
}

}

0 comments on commit 8c03904

Please sign in to comment.