liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
Loading...
Searching...
No Matches
serializer.h File Reference
#include <cstdint>
#include <filesystem>
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include "liblevenshtein/collection/dawg.h"
#include "liblevenshtein/collection/dawg_node.h"
#include "liblevenshtein/proto/liblevenshtein.pb.h"
Include dependency graph for serializer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  liblevenshtein
 Various utilities regarding Levenshtein transducers.
 

Functions

auto liblevenshtein::serialize_protobuf (Dawg *dawg, const fs::path &path) -> bool
 Serializes the given Dawg to protobuf at the given path.
 
auto liblevenshtein::serialize_protobuf (Dawg *dawg, const std::string &path) -> bool
 Serializes the given Dawg to protobuf at the given path.
 
auto liblevenshtein::serialize_protobuf (Dawg *dawg, const char *path) -> bool
 Serializes the given Dawg to protobuf at the given path.
 
auto liblevenshtein::serialize_protobuf (Dawg *dawg, std::ostream &output) -> bool
 Serializes the given Dawg to protobuf into the given output stream.
 
auto liblevenshtein::deserialize_protobuf (const fs::path &path) -> Dawg *
 Deserializes the protobuf containing a Dawg at the given path or returns nullptr if none exists.
 
auto liblevenshtein::deserialize_protobuf (const std::string &path) -> Dawg *
 Deserializes the protobuf containing a Dawg at the given path or returns nullptr if none exists.
 
auto liblevenshtein::deserialize_protobuf (const char *path) -> Dawg *
 Deserializes the protobuf containing a Dawg at the given path or returns nullptr if none exists.
 
auto liblevenshtein::deserialize_protobuf (std::istream &input) -> Dawg *
 Deserializes the protobuf containing a Dawg from the given input stream or returns nullptr if none exists.
 
void liblevenshtein::collect_nodes (DawgNode *source, std::set< uint64_t > &node_ids, std::set< uint64_t > &final_node_ids)
 Collects the DawgNode IDs and final DawgNode IDs of all nodes reachable from the source.
 
void liblevenshtein::collect_edges (DawgNode *source, std::map< std::pair< uint64_t, char >, uint64_t > &edges)
 Collects the transitions from each source to its destination, and the respective character labels.
 
auto liblevenshtein::to_protobuf (Dawg *dawg) -> llp::Dictionary *
 Serializes a Dawg to its protobuf equivalent.
 
auto liblevenshtein::from_protobuf (const llp::Dictionary &dict_proto) -> Dawg *
 Deserializes a Dawg from its protobuf equivalent.