Skip to content

Commit bea5381

Browse files
authored
feat(runtime): support wenet-text-processing cmake build being a sub-… (#111)
* feat(runtime): support wenet-text-processing cmake build being a sub-project * feat(runtime): support wenet-text-processing cmake build being a sub-project
1 parent 885fb69 commit bea5381

18 files changed

Lines changed: 47 additions & 47 deletions

runtime/android/app/src/main/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ include_directories(
1818
add_subdirectory(utils)
1919
add_subdirectory(processor)
2020

21-
link_libraries(processor android)
21+
link_libraries(wetext_processor android)
2222
add_library(${TARGET} SHARED wetextprocessing.cc)

runtime/android/app/src/main/cpp/wetextprocessing.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
// limitations under the License.
1414
#include <jni.h>
1515

16-
#include "processor/processor.h"
17-
#include "utils/flags.h"
18-
#include "utils/string.h"
16+
#include "processor/wetext_processor.h"
17+
#include "utils/wetext_flags.h"
18+
#include "utils/wetext_string.h"
1919

2020
namespace wetextprocessing {
2121

runtime/bin/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
add_executable(processor_main processor_main.cc)
2-
target_link_libraries(processor_main PUBLIC processor)
2+
target_link_libraries(processor_main PUBLIC wetext_processor)

runtime/bin/processor_main.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include <iostream>
1717
#include <string>
1818

19-
#include "processor/processor.h"
20-
#include "utils/flags.h"
19+
#include "processor/wetext_processor.h"
20+
#include "utils/wetext_flags.h"
2121

2222
DEFINE_string(text, "", "input string");
2323
DEFINE_string(file, "", "input file");

runtime/processor/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
add_library(processor STATIC
2-
processor.cc
3-
token_parser.cc
1+
add_library(wetext_processor STATIC
2+
wetext_processor.cc
3+
wetext_token_parser.cc
44
)
55
if(ANDROID)
6-
target_link_libraries(processor PUBLIC fst utils)
6+
target_link_libraries(wetext_processor PUBLIC fst wetext_utils)
77
else()
88
if(MSVC)
9-
target_link_libraries(processor PUBLIC fst utils)
9+
target_link_libraries(wetext_processor PUBLIC fst wetext_utils)
1010
else()
11-
target_link_libraries(processor PUBLIC dl fst utils)
11+
target_link_libraries(wetext_processor PUBLIC dl fst wetext_utils)
1212
endif()
13-
endif()
13+
endif()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "processor/processor.h"
15+
#include "processor/wetext_processor.h"
1616

1717
using fst::StringTokenType;
1818

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef PROCESSOR_PROCESSOR_H_
16-
#define PROCESSOR_PROCESSOR_H_
15+
#ifndef PROCESSOR_WETEXT_PROCESSOR_H_
16+
#define PROCESSOR_WETEXT_PROCESSOR_H_
1717

1818
#include "fst/fstlib.h"
1919

20-
#include "processor/token_parser.h"
20+
#include "processor/wetext_token_parser.h"
2121

2222
using fst::StdArc;
2323
using fst::StdVectorFst;
@@ -45,4 +45,4 @@ class Processor {
4545

4646
} // namespace wetext
4747

48-
#endif // PROCESSOR_PROCESSOR_H_
48+
#endif // PROCESSOR_WETEXT_PROCESSOR_H_
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "processor/token_parser.h"
15+
#include "processor/wetext_token_parser.h"
1616

17-
#include "utils/log.h"
18-
#include "utils/string.h"
17+
#include "utils/wetext_log.h"
18+
#include "utils/wetext_string.h"
1919

2020
namespace wetext {
2121
const std::string EOS = "<EOS>";
@@ -48,7 +48,7 @@ TokenParser::TokenParser(ParseType type) {
4848
}
4949

5050
void TokenParser::Load(const std::string& input) {
51-
SplitUTF8StringToChars(input, &text_);
51+
wetext::SplitUTF8StringToChars(input, &text_);
5252
CHECK_GT(text_.size(), 0);
5353
index_ = 0;
5454
ch_ = text_[0];
@@ -83,7 +83,7 @@ bool TokenParser::ParseChar(const std::string& exp) {
8383
bool TokenParser::ParseChars(const std::string& exp) {
8484
bool ok = false;
8585
std::vector<std::string> chars;
86-
SplitUTF8StringToChars(exp, &chars);
86+
wetext::SplitUTF8StringToChars(exp, &chars);
8787
for (const auto& x : chars) {
8888
ok |= ParseChar(x);
8989
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef PROCESSOR_TOKEN_PARSER_H_
16-
#define PROCESSOR_TOKEN_PARSER_H_
15+
#ifndef PROCESSOR_WETEXT_TOKEN_PARSER_H_
16+
#define PROCESSOR_WETEXT_TOKEN_PARSER_H_
1717

1818
#include <set>
1919
#include <string>
@@ -88,4 +88,4 @@ class TokenParser {
8888

8989
} // namespace wetext
9090

91-
#endif // PROCESSOR_TOKEN_PARSER_H_
91+
#endif // PROCESSOR_WETEXT_TOKEN_PARSER_H_

runtime/test/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ link_libraries(gtest_main gmock)
33
include(GoogleTest)
44

55
add_executable(string_test string_test.cc)
6-
target_link_libraries(string_test PUBLIC utils)
6+
target_link_libraries(string_test PUBLIC wetext_utils)
77
gtest_discover_tests(string_test)
88

99
if(NOT MSVC)
1010
# token_parser_test uses the macro to access the private members
1111
add_executable(token_parser_test token_parser_test.cc)
12-
target_link_libraries(token_parser_test PUBLIC processor)
12+
target_link_libraries(token_parser_test PUBLIC wetext_processor)
1313
gtest_discover_tests(token_parser_test)
1414
endif()
1515

1616
add_executable(processor_test processor_test.cc)
17-
target_link_libraries(processor_test PUBLIC processor)
17+
target_link_libraries(processor_test PUBLIC wetext_processor)
1818
gtest_discover_tests(processor_test)

0 commit comments

Comments
 (0)