yhirose / cpp-fstlib Goto Github PK
View Code? Open in Web Editor NEWA single file C++17 header-only Minimal Acyclic Subsequential Transducers, or Finite State Transducers
License: MIT License
A single file C++17 header-only Minimal Acyclic Subsequential Transducers, or Finite State Transducers
License: MIT License
Line 1830 in 498dad4
In current condition, state_output will not add up to final output in current frame
I try to fix like this:
if (ope.data.final && atm.is_match()) {
if (prefix.empty() || (prefix.size() == 1 && prefix.front() == arc)) {
if (OutputTraits<output_t>::type() == OutputType::none_t ||
OutputTraits<output_t>::empty(state_output)) {
accept(word, output);
} else {
accept(word, output + state_output);
}
}
}
I use API named common_prefix_search
but the result is not what i want.
I use the example in tutorials.
for example:
// input
const std::vector<std::pair<std::string, std::string>> items = {
{"hello", "こんにちは!"},
{"hello world", "こんにちは世界!"}, // incorrect sort order entry...
{"world", "世界!"},
};
//Omit the initialization process for fstmap;
//....
//search result with prefix 'h' but no result returned.
auto prefixes = matcher.common_prefix_search("h");
//output=0;
cout << prefixes.size() << endl;
I expect the result to be “こんにちは!” and “こんにちは世界!”.
Which interface can get the expected result? And what does 'common_prefix_search' mean?
when too many terms(billions of),memory usage is huge(servel GB); Lucene uses pagecache to lazy load fst bytes,is it possible for fstlib?
Hello, I am diving into let the fstlib support uint64_t type. When I simply change the classes instantiated for std::string and uint32_t types to uint64_t, some error are produced in test file. Can you give some hint that where should I make changes if I want to support uint64_t type?
const std::vector<std::pair<std::string, std::string>> items =
{
{"hello", "a"},
{"hello world", "b"},
{"world", "c"}
};
std::stringstream out;
auto sorted = false; // ask fst::compile to sort entries
auto [result, error_line] = fst::compilestd::string(items, out, sorted);
const auto &byte_code = out.str();
fst::mapstd::string matcher(byte_code.data(), byte_code.size());
//do something
****** here, I have more items to add, how to do that ? ******
hash function use a buffer 1024, is it enough for large of data
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.