Browse Source

2024.5.16 测试整体构建

master
Administrator 1 year ago
parent
commit
c00c8b6383
4 changed files with 19 additions and 21 deletions
  1. +0
    -1
      CMakeLists.txt
  2. +4
    -13
      post_processor/CMakeLists.txt
  3. +2
    -2
      post_processor/post_processor.cc
  4. +13
    -5
      post_processor/processor/wetext_processor.cc

+ 0
- 1
CMakeLists.txt

@ -35,7 +35,6 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/kaldi
)
# Build all libraries
add_subdirectory(utils)
add_subdirectory(frontend)

+ 4
- 13
post_processor/CMakeLists.txt

@ -1,18 +1,9 @@
message(STATUS "post_processor dir:${CMAKE_CURRENT_SOURCE_DIR}")
add_library(wetext_utils STATIC utils/wetext_string.cc)
target_link_libraries(wetext_utils PUBLIC glog)
add_library(wetext_processor STATIC
processor/wetext_processor.cc
processor/wetext_token_parser.cc
)
target_link_libraries(wetext_processor PUBLIC dl fst wetext_utils)
#add_executable(processor_main processor/processor_main.cc)
#
#target_link_libraries(processor_main PUBLIC wetext_processor)
add_library(post_processor STATIC
post_processor.cc
utils/wetext_string.cc
processor/wetext_processor.cc
processor/wetext_token_parser.cc
)
target_link_libraries(post_processor PUBLIC utils wetext_processor wetext_utils)
target_link_libraries(post_processor PUBLIC utils ${OPENFST_LIBRARYS})

+ 2
- 2
post_processor/post_processor.cc

@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License
#include "post_processor/post_processor.h"
#include "post_processor.h"
#include <sstream>
#include <vector>
#include "processor/wetext_processor.h"
@ -65,7 +65,7 @@ std::string PostProcessor::ProcessSpace(const std::string& str) {
std::string del_substr(const std::string& str, const std::string& sub) {
std::string result = str;
int pos = 0;
while (string::npos != (pos = result.find(sub))) {
while (std::string::npos != (pos = result.find(sub))) {
result.erase(pos, sub.size());
}
return result;

+ 13
- 5
post_processor/processor/wetext_processor.cc

@ -13,16 +13,24 @@
// limitations under the License.
#include "wetext_processor.h"
using fst::StringTokenType;
#include <fst/string.h>
#include <fst/compat.h>
#include <fst/extensions/mpdt/compose.h>
#include <fst/extensions/mpdt/mpdt.h>
#include <fst/extensions/pdt/compose.h>
#include <fst/extensions/pdt/pdt.h>
#include <fst/extensions/pdt/shortest-path.h>
#include <fst/arc.h>
#include <fst/fstlib.h>
#include <fst/fst.h>
#include <fst/vector-fst.h>
namespace wetext {
Processor::Processor(const std::string& tagger_path,
const std::string& verbalizer_path) {
tagger_.reset(StdVectorFst::Read(tagger_path));
verbalizer_.reset(StdVectorFst::Read(verbalizer_path));
compiler_ = std::make_shared<StringCompiler<StdArc>>(StringTokenType::BYTE);
printer_ = std::make_shared<StringPrinter<StdArc>>(StringTokenType::BYTE);
compiler_ = std::make_shared<StringCompiler<StdArc>>(fst::StringTokenType::BYTE);
printer_ = std::make_shared<StringPrinter<StdArc>>(fst::StringTokenType::BYTE);
if (tagger_path.find("_tn_") != tagger_path.npos) {
parse_type_ = ParseType::kTN;

Loading…
Cancel
Save