File size: 1,313 Bytes
158b61b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * AlignedSentenceSyntax.h
 *
 *  Created on: 26 Feb 2014
 *      Author: hieu
 */

#pragma once

#include "AlignedSentence.h"
#include "SyntaxTree.h"
#include "pugixml.hpp"

class AlignedSentenceSyntax : public AlignedSentence
{
public:
  AlignedSentenceSyntax(int lineNum,
                        const std::string &source,
                        const std::string &target,
                        const std::string &alignment);
  virtual ~AlignedSentenceSyntax();

  void Create(const Parameter &params);

  //virtual std::string Debug() const;
protected:
  std::string m_sourceStr, m_targetStr, m_alignmentStr;
  SyntaxTree m_sourceTree, m_targetTree;

  void XMLParse(Phrase &output,
                SyntaxTree &tree,
                const std::string input,
                const Parameter &params);
  void XMLParse(Phrase &output,
                SyntaxTree &tree,
                const pugi::xml_node &parentNode,
                const Parameter &params);
  void CreateNonTerms();
  void CreateNonTerms(ConsistentPhrase &cp,
                      const SyntaxTree::Labels &sourceLabels,
                      const SyntaxTree::Labels &targetLabels);
  void Populate(bool isSyntax, int mixedSyntaxType, const Parameter &params,
                std::string line, Phrase &phrase, SyntaxTree &tree);

};