Skip to content

Commit

Permalink
support no-cache for fst.
Browse files Browse the repository at this point in the history
  • Loading branch information
dingbin committed Oct 15, 2021
1 parent bce9765 commit a4db8e3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/main/fst/fst/fst_core/fst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ uint64_t FstBuilder::FreezeNode(FstWriteNodePtr node) {
return addr;
}
uint64_t addrOffset = m_outputStream->GetTotalBytesCnt();
bool ret = m_node2AddrOffsetMap.Put(node,addrOffset);
assert(ret);
m_node2AddrOffsetMap.Put(node,addrOffset);
node->Dump(m_outputStream,m_hasOutput);
return addrOffset;
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/fst/fst/fst_core/fst.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ class FstBuilder {

uint64_t addrOffset = m_outputStream->GetTotalBytesCnt();
s_FinalTerminateNode->Dump(m_outputStream,m_hasOutput);
bool ret = m_node2AddrOffsetMap.Put(s_FinalTerminateNode,addrOffset);
assert(ret);
m_node2AddrOffsetMap.Put(s_FinalTerminateNode,addrOffset);
}
~FstBuilder() {}
public:
Expand Down
4 changes: 2 additions & 2 deletions src/main/fst/fst/fst_core/test/fst_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int main(int argc, char** argv) {
if (mapSubCmd) {
mapSubCmd->add_option("-f,--dict-file",dictFile,"dictionary file which with format like:`key,value` for every line.")->check(CLI::ExistingFile)->required(true);
mapSubCmd->add_option("-o,--fst-file",fstFile,"output fst data file will be generated.")->check(CLI::NonexistentPath)->required(true);
mapSubCmd->add_option("-c,--cache-size",maxCacheSize,"max cache size used with unit MB bytes,default 1000M if not set")->default_val(1000)->check(CLI::PositiveNumber)->required(false);
mapSubCmd->add_option("-c,--cache-size",maxCacheSize,"max cache size used with unit MB bytes,default 1000M if not set")->default_val(1000)->check(CLI::NonNegativeNumber)->required(false);

mapSubCmd->add_flag("-s,--sorted",isFileSorted,"Set this if the input data is already lexicographically sorted. This will make fst construction much faster.")->default_val(false)->required(false);
mapSubCmd->add_option("-w,--work-directory",workDir,"work directory specified for sort input dictionary file if necessary,default /tmp if not set")->default_val("/tmp")->check(CLI::ExistingDirectory)->required(false);
Expand All @@ -64,7 +64,7 @@ int main(int argc, char** argv) {
if (setSubCmd) {
setSubCmd->add_option("-f,--dict-file",dictFile,"dictionary file which with format like:`key,value` for every line.")->check(CLI::ExistingFile)->required(true);
setSubCmd->add_option("-o,--fst-file",fstFile,"output fst data file will be generated.")->check(CLI::NonexistentPath)->required(true);
setSubCmd->add_option("-c,--cache-size",maxCacheSize,"max cache size used with unit MB bytes,default 1000M if not set")->default_val(1000)->check(CLI::PositiveNumber)->required(false);
setSubCmd->add_option("-c,--cache-size",maxCacheSize,"max cache size used with unit MB bytes,default 1000M if not set")->default_val(1000)->check(CLI::NonNegativeNumber)->required(false);

setSubCmd->add_flag("-s,--sorted",isFileSorted,"Set this if the input data is already lexicographically sorted. This will make fst construction much faster.")->default_val(false)->required(false);
setSubCmd->add_option("-w,--work-directory",workDir,"work directory specified for sort input dictionary file if necessary,default /tmp if not set")->default_val("/tmp")->check(CLI::ExistingDirectory)->required(false);
Expand Down

0 comments on commit a4db8e3

Please sign in to comment.