Difference between revisions of "User:Himanshu40"

From Apertium
Jump to navigation Jump to search
m
 
(6 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
'''Weighted transducers''' are automata in which each transition in addition to its usual input label is augmented with an output label from a possible new alphabet, and carries some weight element of a semiring.
 
'''Weighted transducers''' are automata in which each transition in addition to its usual input label is augmented with an output label from a possible new alphabet, and carries some weight element of a semiring.
   
For weight in lttoolbox which currently supports DFA system, we need '''Semi-ring''' for calculating weight.
+
For weight in lttoolbox which currently supports NDFA system, we need '''Semi-ring''' for calculating weight.
   
A '''Semiring''' is defined by two binary operations '''⊕''' and '''⊗''' and two designated elements '''0''' and '''1''' with following properties:-
+
A '''Semiring''' is defined by two binary operations '''⊕''' and '''⊗''' and two designated elements '''0''' and '''1''' and it consists of a system like '''K, ⊕, ⊗, 0, 1''' with following properties:-
 
* '''⊕''' shows associative, commutative and has 0 as its own identity.
 
* '''⊕''' shows associative, commutative and has 0 as its own identity.
 
* '''⊗''' shows associative and has 1 as its own identity.
 
* '''⊗''' shows associative and has 1 as its own identity.
 
A '''left semiring''' distributes on the left and also a '''right semiring''' is similarly defined.
 
A '''left semiring''' distributes on the left and also a '''right semiring''' is similarly defined.
   
  +
'''⊕''' is used to combine the weight of two identically labeled alternative paths.
==Store weights in lttoolbox==
 
  +
  +
'''⊗''' is used to combine weights along a path or when matching paths in composition or intersection.
  +
 
==Calculation of weights in lttoolbox==
  +
An '''arc weight''' in an FST gives the cost of taking that transition.
 
* A <code>Weight</code> class must have binary functions <code>Plus</code> and <code>Times</code> these must form a left or right semiring.
 
* A <code>Weight</code> class must have binary functions <code>Plus</code> and <code>Times</code> these must form a left or right semiring.
 
Also in class <code>Weight</code>, there are some additions which must be defined like the following:-
 
Also in class <code>Weight</code>, there are some additions which must be defined like the following:-
Line 19: Line 24:
 
* <code>Read(istream &)</code> :- This reads binary representation of a weight.
 
* <code>Read(istream &)</code> :- This reads binary representation of a weight.
 
* <code>Write(ostream &)</code> :- This writes binary representation of a weight.
 
* <code>Write(ostream &)</code> :- This writes binary representation of a weight.
  +
* <code>ApproxEqual</code> :- This shows approximate equality (for inexact weights).
* <code>NoWeight</code> :- This is a static member function that returns an element which is not a set member and used to signal an error.
 
*
 

Latest revision as of 17:38, 6 January 2018

Weights to lttoolbox[edit]

Theory[edit]

Weighted transducers are automata in which each transition in addition to its usual input label is augmented with an output label from a possible new alphabet, and carries some weight element of a semiring.

For weight in lttoolbox which currently supports NDFA system, we need Semi-ring for calculating weight.

A Semiring is defined by two binary operations and and two designated elements 0 and 1 and it consists of a system like K, ⊕, ⊗, 0, 1 with following properties:-

  • shows associative, commutative and has 0 as its own identity.
  • shows associative and has 1 as its own identity.

A left semiring distributes on the left and also a right semiring is similarly defined.

is used to combine the weight of two identically labeled alternative paths.

is used to combine weights along a path or when matching paths in composition or intersection.

Calculation of weights in lttoolbox[edit]

An arc weight in an FST gives the cost of taking that transition.

  • A Weight class must have binary functions Plus and Times these must form a left or right semiring.

Also in class Weight, there are some additions which must be defined like the following:-

  • >> :- This reads textual representation of a weight.
  • << :- This prints textual representation of a weight.
  • LeftSemiring :- This indicates how weights form a left semi-ring.
  • RightSemiring :- This indicates how weights form a right semi-ring.
  • Read(istream &) :- This reads binary representation of a weight.
  • Write(ostream &) :- This writes binary representation of a weight.
  • ApproxEqual :- This shows approximate equality (for inexact weights).