Skip to content

Commit 0ca3110

Browse files
authored
fix: OpenFst compatibility + add C++ runtime CI (#359) (#360)
* fix: use StringTokenType for OpenFst 1.8+ compatibility (#359) * ci: add C++ runtime build workflow Trigger on runtime/** changes. Builds on ubuntu and macos. * fix: revert to TokenType for csukuangfj/openfst fork compatibility The project uses csukuangfj/openfst v1.8.5 which keeps the original fst::TokenType enum. The previous commit incorrectly renamed it to StringTokenType (which is used in official OpenFst releases). * fix: drop explicit TokenType::BYTE for OpenFst compatibility (#359) Both StringCompiler and StringPrinter default to BYTE mode, so the argument can be omitted entirely. This avoids the TokenType vs StringTokenType naming difference between the csukuangfj fork and official OpenFst releases.
1 parent eabb5b9 commit 0ca3110

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

.github/workflows/runtime.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Runtime Build
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- 'runtime/**'
8+
- '.github/workflows/runtime.yml'
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest]
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Build runtime
20+
run: |
21+
cmake -B build -S runtime -DBUILD_TESTING=OFF
22+
cmake --build build -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)

runtime/processor/wetext_processor.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@
1414

1515
#include "processor/wetext_processor.h"
1616

17-
using fst::TokenType;
18-
1917
namespace wetext {
2018
Processor::Processor(const std::string& tagger_path,
2119
const std::string& verbalizer_path) {
2220
tagger_.reset(StdVectorFst::Read(tagger_path));
2321
verbalizer_.reset(StdVectorFst::Read(verbalizer_path));
24-
compiler_ = std::make_shared<StringCompiler<StdArc>>(TokenType::BYTE);
25-
printer_ = std::make_shared<StringPrinter<StdArc>>(TokenType::BYTE);
22+
compiler_ = std::make_shared<StringCompiler<StdArc>>();
23+
printer_ = std::make_shared<StringPrinter<StdArc>>();
2624

2725
if (tagger_path.find("zh_tn_") != tagger_path.npos) {
2826
parse_type_ = ParseType::kZH_TN;

0 commit comments

Comments
 (0)