Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: ${{ github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]') || fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') }}
python-version: ['3.9']
steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 6 additions & 0 deletions tn/chinese/data/math/operator_unambiguous.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
× 乘
÷ 除
≥ 大于等于
≤ 小于等于
>= 大于等于
<= 小于等于
3 changes: 2 additions & 1 deletion tn/chinese/rules/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ def __init__(self, cardinal=None):

def build_tagger(self):
operator = string_file(get_abs_path("chinese/data/math/operator.tsv"))
unambiguous_operator = string_file(get_abs_path("chinese/data/math/operator_unambiguous.tsv"))
symbols = cross("~", "到") | cross(":", "比") | cross("<", "小于") | cross(">", "大于")

number = self.cardinal.number
tagger = number + (delete(" ").ques + (operator | symbols) + delete(" ").ques + number).star
tagger |= operator
tagger |= unambiguous_operator
tagger = insert('value: "') + tagger + insert('"')
self.tagger = self.add_tokens(tagger)
Loading