Skip to content

Commit

Permalink
Merge pull request #24 from zoho/hawking_dev
Browse files Browse the repository at this point in the history
Master Merge Hawking Enhancement  v0.1.5
  • Loading branch information
ArulVendhan committed Nov 1, 2021
2 parents 3f59aed + fddd0af commit e0d20bc
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.zoho</groupId>
<artifactId>hawking</artifactId>
<version>0.1.4</version>
<version>0.1.5</version>
<packaging>jar</packaging>
<name>Hawking</name>
<description>Hawking is a natural language date time parser that extracts date and time from text with context and parse to the required format.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ private static int findDateType(DateTimeEssentials dateTimeEssentials) {
for (Triple<String, Integer, Integer> triple : triples) {
if (triple.first.equals("R")) {
String relationWord = dateTimeEssentials.getSentence().substring(triple.second, triple.third).replace("[^a-zA-z]", ""); //No I18N
if (PrepositionConstants.RELATIONSHIP_RANGE.contains(relationWord)) {
if (PrepositionConstants.RELATIONSHIP_RANGE.contains(relationWord.toLowerCase())) {
dateType = 0;
} else if (PrepositionConstants.RELATIONSHIP_SET.contains(relationWord)) {
} else if (PrepositionConstants.RELATIONSHIP_SET.contains(relationWord.toLowerCase())) {
dateType = 1;
} else {
dateType = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public class DateTimeWordProperties {

public static final WordProperty AUGUST = new WordProperty("august", MonthsOfYear.MONTH_EIGHT, new String[]{"aug"});

public static final WordProperty SEPTEMBER = new WordProperty("september", MonthsOfYear.MONTH_NINE, new String[]{"sep"});
public static final WordProperty SEPTEMBER = new WordProperty("september", MonthsOfYear.MONTH_NINE, new String[]{"sep","sept"});

public static final WordProperty OCTOBER = new WordProperty("october", MonthsOfYear.MONTH_TEN, new String[]{"oct"});

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/zoho/hawking/language/english/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ private static CRFClassifier<CoreLabel> getCRFInstance() {
}

public static List<Triple<String, Integer, Integer>> parse(String input) {
input = input.replaceAll("http","----"); //No I18N
input = input.replaceAll("www","---"); //No I18N
return crf.classifyToCharacterOffsets(input);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zoho/hawking/utils/RecognizerTagger.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RecognizerTagger {
private final static Pattern exact_year = Pattern.compile("^\\d{4}$");
private final static Pattern exact_number_1 = Pattern.compile(
"^(first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eightheenth|ninteenth|twentieth|twenty-first|twenty-second|twenty-third|twenty-fourth|twenty-fifth|twenty-sixth|twenty-seventh|twenty-eighth|twenty-ninth|thirtieth|thirty-first|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|forty|fifty|st|nd|rd|th)$");
private final static Pattern exact_number_2 = Pattern.compile("(\\d+)(st|nd|rd|th|ᵗʰ|ˢᵗ|ⁿᵈ|ʳᵈ)?");
private final static Pattern exact_number_2 = Pattern.compile("^((\\d+)(st|nd|rd|th|ᵗʰ|ˢᵗ|ⁿᵈ|ʳᵈ)?)$");

public static String getTagger(String word) {
String tag = "";
Expand Down
Binary file modified src/main/resources/parser/parser.crf.ser.gz
Binary file not shown.

0 comments on commit e0d20bc

Please sign in to comment.