Skip to content

Commit

Permalink
expand part-of-speech determination
Browse files Browse the repository at this point in the history
  • Loading branch information
choykarl committed Nov 29, 2023
1 parent 694c907 commit e04ba7c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Easydict/Feature/Service/Model/EZQueryResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "EZQueryResult.h"
#import "EZLocalStorage.h"
#import "NSArray+EZChineseText.h"
#import "NSString+EZUtils.h"

/// Convert part
/**
Expand Down Expand Up @@ -36,7 +37,11 @@
@"det": @"det.", // determinative 限定词
@"abbreviation": @"abbr.",
@"abbr": @"abbr.",
@"web": @"web."
@"infinitive": @"inf.",
@"participle": @"part.",
@"numeral": @"num.",
@"article": @"art.",
@"web": @"Web"
};

static NSDictionary *chinesePartOfSpeechMap = @{
Expand All @@ -50,7 +55,11 @@
@"感叹词" : @"interj.",
@"限定词" : @"det.", // determinative 限定词
@"缩写" : @"abbr.",
@"网络" : @"web."
@"不定词" : @"inf.",
@"分词" : @"part.",
@"数词" : @"num.",
@"冠词" : @"art.",
@"网络" : @"Web"
};

NSString *partName = partOfSpeechMap[part];
Expand All @@ -60,7 +69,11 @@
}

if (!partName) {
partName = part;
if ([part isEnglishWord]) {
partName = [NSString stringWithFormat:@"%@.", part];
} else {
partName = part;
}
}

return partName;
Expand Down

0 comments on commit e04ba7c

Please sign in to comment.