text-io.h revision f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2
1// text-io.h
2
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Copyright 2005-2010 Google, Inc.
16// Author: riley@google.com (Michael Riley)
17// Modified: jpr@google.com (Jake Ratkiewicz) to work with generic WeightClass
18//
19// \file
20// Utilities for reading and writing textual strings representing
21// states, labels, and weights and files specifying label-label pairs
22// and potentials (state-weight pairs).
23//
24
25#ifndef FST_SCRIPT_TEXT_IO_H__
26#define FST_SCRIPT_TEXT_IO_H__
27
28#include <string>
29#include <vector>
30using std::vector;
31
32
33#include <iostream>
34#include <fstream>
35#include <fst/script/weight-class.h>
36
37namespace fst {
38namespace script {
39
40bool ReadPotentials(const string &weight_type,
41                    const string& filename,
42                    vector<WeightClass>* potential);
43
44bool WritePotentials(const string& filename,
45                     const vector<WeightClass>& potential);
46
47}  // namespace script
48}  // namespace fst
49
50#endif  // FST_SCRIPT_TEXT_IO_H__
51