text-utils.h File Reference
#include <errno.h>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <limits>
#include "base/kaldi-common.h"
Include dependency graph for text-utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ConfigLine
 This class is responsible for parsing input like hi-there xx=yyy a=b c empty= f-oo=Append(bar, sss) ba_z=123 bing='a b c' baz="a b c d='a b' e" and giving you access to the fields, in this case. More...
 

Namespaces

 kaldi
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for mispronunciations detection tasks, the reference:
 

Functions

void SplitStringToVector (const std::string &full, const char *delim, bool omit_empty_strings, std::vector< std::string > *out)
 Split a string using any of the single character delimiters. More...
 
void JoinVectorToString (const std::vector< std::string > &vec_in, const char *delim, bool omit_empty_strings, std::string *str_out)
 Joins the elements of a vector of strings into a single string using "delim" as the delimiter. More...
 
template<class I >
bool SplitStringToIntegers (const std::string &full, const char *delim, bool omit_empty_strings, std::vector< I > *out)
 Split a string (e.g. More...
 
template<class F >
bool SplitStringToFloats (const std::string &full, const char *delim, bool omit_empty_strings, std::vector< F > *out)
 
template<class Int >
bool ConvertStringToInteger (const std::string &str, Int *out)
 Converts a string into an integer via strtoll and returns false if there was any kind of problem (i.e. More...
 
template<typename T >
bool ConvertStringToReal (const std::string &str, T *out)
 ConvertStringToReal converts a string into either float or double and returns false if there was any kind of problem (i.e. More...
 
void Trim (std::string *str)
 Removes the beginning and trailing whitespaces from a string. More...
 
void SplitStringOnFirstSpace (const std::string &line, std::string *first, std::string *rest)
 Removes leading and trailing white space from the string, then splits on the first section of whitespace found (if present), putting the part before the whitespace in "first" and the rest in "rest". More...
 
bool IsToken (const std::string &token)
 Returns true if "token" is nonempty, and all characters are printable and whitespace-free. More...
 
bool IsLine (const std::string &line)
 Returns true if "line" is free of
characters and unprintable characters, and does not contain leading or trailing whitespace. More...
 
bool StringsApproxEqual (const std::string &a, const std::string &b, int32 decimal_places_check=2)
 This function returns true when two text strings are approximately equal, and false when they are not. More...
 
void ExpectOneOrTwoTokens (std::istream &is, bool binary, const std::string &token1, const std::string &token2)
 This function is like ExpectToken but for two tokens, and it will either accept token1 and then token2, or just token2. More...
 
void ReadConfigLines (std::istream &is, std::vector< std::string > *lines)
 This function reads in a config file and *appends* its contents to a vector of lines; it is responsible for removing comments (anything after '#') and stripping out any lines that contain only whitespace after comment removal. More...
 
void ParseConfigLines (const std::vector< std::string > &lines, std::vector< ConfigLine > *config_lines)
 This function converts config-lines from a simple sequence of strings as output by ReadConfigLines(), into a sequence of first-tokens and name-value pairs. More...
 
bool IsValidName (const std::string &name)
 Returns true if 'name' would be a valid name for a component or node in a nnet3Nnet. More...