diff options
author | 2015-02-28 15:26:08 -0400 | |
---|---|---|
committer | 2015-02-28 15:26:08 -0400 | |
commit | 9f412ecfb867c63bf2b22c5649173226278a2ded (patch) | |
tree | 713d65e29085b83f2019321a9d66097e068b7e28 /sci-misc/openfst | |
parent | profiles/categories cleanup: remove stray sys-process category (diff) | |
download | sci-9f412ecfb867c63bf2b22c5649173226278a2ded.tar.gz sci-9f412ecfb867c63bf2b22c5649173226278a2ded.tar.bz2 sci-9f412ecfb867c63bf2b22c5649173226278a2ded.zip |
sci-misc/openfst: version bump
Package-Manager: portage-2.2.17
Diffstat (limited to 'sci-misc/openfst')
-rw-r--r-- | sci-misc/openfst/ChangeLog | 8 | ||||
-rw-r--r-- | sci-misc/openfst/Manifest | 1 | ||||
-rw-r--r-- | sci-misc/openfst/files/kaldi-openfst-1.4.1.patch | 269 | ||||
-rw-r--r-- | sci-misc/openfst/openfst-1.4.1.ebuild | 19 |
4 files changed, 296 insertions, 1 deletions
diff --git a/sci-misc/openfst/ChangeLog b/sci-misc/openfst/ChangeLog index 47bb94e86..4278e322a 100644 --- a/sci-misc/openfst/ChangeLog +++ b/sci-misc/openfst/ChangeLog @@ -1,7 +1,13 @@ # ChangeLog for sci-misc/openfst -# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 +# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ +*openfst-1.4.1 (28 Feb 2015) + + 28 Feb 2015; Pavel Denisov <pavel.a.denisov@gmail.com> +openfst-1.4.1.ebuild, + +files/kaldi-openfst-1.4.1.patch: + Version bump. + 12 Nov 2014; Justin Lecher <jlec@gentoo.org> -openfst-1.2.7.ebuild: Drop old diff --git a/sci-misc/openfst/Manifest b/sci-misc/openfst/Manifest index ad46d23ff..7312addb8 100644 --- a/sci-misc/openfst/Manifest +++ b/sci-misc/openfst/Manifest @@ -1 +1,2 @@ DIST openfst-1.3.4.tar.gz 769158 SHA256 e95fa96674e1c9d6866bbf79b9cd755c5121ad165b76224c7c6bbfa139399a61 SHA512 6ed87cbb949776b8702545a51d129e03f33428369b20255d637191e054ce04e529969aef49549b098b144cfde45cd9b741e6cba6680f815c04ad5717fdb0cbd9 WHIRLPOOL 593fd22668044f9ec8df70c274ee910f9da85a48fcd33c73993e54afd21298208d69804342b4e3a5d36e59aa92e853e84d95d1623c3708e7e1fc70e42916949f +DIST openfst-1.4.1.tar.gz 824020 SHA256 e671bf6bd4425a1fed4e7543a024201b74869bfdd029bdf9d10c53a3c2818277 SHA512 8cb3b3e83155d1b2bd0075bab4fcf5d7160b427af87a2c03217a614a9dd1f9d7d1a67d404d897ad8659532686a7ad2fd20270de7cf838c6f38d4ae807369c51f WHIRLPOOL b9ae3562e2c7b2d651852d35e56ed7e678a990b46c7f720ac3a8e80cc7edee786bff3e1ab34aa6d5e9d33ec0821dbff8d6a5b6ea97c32ced40474891bfe4a4a3 diff --git a/sci-misc/openfst/files/kaldi-openfst-1.4.1.patch b/sci-misc/openfst/files/kaldi-openfst-1.4.1.patch new file mode 100644 index 000000000..140ea4e24 --- /dev/null +++ b/sci-misc/openfst/files/kaldi-openfst-1.4.1.patch @@ -0,0 +1,269 @@ +diff -crB openfst-1.4.1.orig/src/include/fst/lock.h openfst-1.4.1/src/include/fst/lock.h +*** openfst-1.4.1.orig/src/include/fst/lock.h 2012-04-25 19:43:47.000000000 -0400 +--- openfst-1.4.1/src/include/fst/lock.h 2015-02-28 14:12:29.009385600 -0400 +*************** +*** 78,85 **** + RefCounter() : count_(1) {} + + int count() const { return count_; } +! int Incr() const { return ++count_; } +! int Decr() const { return --count_; } + + private: + mutable int count_; +--- 78,93 ---- + RefCounter() : count_(1) {} + + int count() const { return count_; } +! +! // below lines are modifications of openfst for multi-thrads support, +! // from tools/extras/openfst_gcc41up.patch, applied by tools/Makefile, +! // applicable to gcc 4.1 or above +! // int Incr() const { return ++count_; } +! // int Decr() const { return --count_; } +! +! int Incr() const { return __sync_add_and_fetch(&count_, 1); } +! int Decr() const { return __sync_sub_and_fetch(&count_, 1); } +! // end modifications + + private: + mutable int count_; +diff -crB openfst-1.4.1.orig/src/include/fst/minimize.h openfst-1.4.1/src/include/fst/minimize.h +*** openfst-1.4.1.orig/src/include/fst/minimize.h 2014-04-29 18:15:17.000000000 -0400 +--- openfst-1.4.1/src/include/fst/minimize.h 2015-02-28 14:11:39.270566070 -0400 +*************** +*** 134,140 **** + typedef typename A::Weight Weight; + typedef ReverseArc<A> RevA; + +! CyclicMinimizer(const ExpandedFst<A>& fst) { + Initialize(fst); + Compute(fst); + } +--- 134,147 ---- + typedef typename A::Weight Weight; + typedef ReverseArc<A> RevA; + +! CyclicMinimizer(const ExpandedFst<A>& fst): +! // tell the Partition data-member to expect multiple repeated +! // calls to SplitOn with the same element if we are non-deterministic. +! P_(fst.Properties(kIDeterministic, true) == 0) { +! if(fst.Properties(kIDeterministic, true) == 0) +! CHECK(Weight::Properties() & kIdempotent); // this minimization +! // algorithm for non-deterministic FSTs can only work with idempotent +! // semirings. + Initialize(fst); + Compute(fst); + } +*************** +*** 315,321 **** + typedef typename A::StateId ClassId; + typedef typename A::Weight Weight; + +! AcyclicMinimizer(const ExpandedFst<A>& fst) { + Initialize(fst); + Refine(fst); + } +--- 322,334 ---- + typedef typename A::StateId ClassId; + typedef typename A::Weight Weight; + +! AcyclicMinimizer(const ExpandedFst<A>& fst): +! // tell the Partition data-member to expect multiple repeated +! // calls to SplitOn with the same element if we are non-deterministic. +! partition_(fst.Properties(kIDeterministic, true) == 0) { +! if(fst.Properties(kIDeterministic, true) == 0) +! CHECK(Weight::Properties() & kIdempotent); // minimization for +! // non-deterministic FSTs can only work with idempotent semirings. + Initialize(fst); + Refine(fst); + } +*************** +*** 531,543 **** + void Minimize(MutableFst<A>* fst, + MutableFst<A>* sfst = 0, + float delta = kDelta) { +! uint64 props = fst->Properties(kAcceptor | kIDeterministic| +! kWeighted | kUnweighted, true); +! if (!(props & kIDeterministic)) { +! FSTERROR() << "FST is not deterministic"; +! fst->SetProperties(kError, kError); +! return; +! } + + if (!(props & kAcceptor)) { // weighted transducer + VectorFst< GallicArc<A, GALLIC_LEFT> > gfst; +--- 544,550 ---- + void Minimize(MutableFst<A>* fst, + MutableFst<A>* sfst = 0, + float delta = kDelta) { +! uint64 props = fst->Properties(kAcceptor | kWeighted | kUnweighted, true); + + if (!(props & kAcceptor)) { // weighted transducer + VectorFst< GallicArc<A, GALLIC_LEFT> > gfst; +diff -crB openfst-1.4.1.orig/src/include/fst/partition.h openfst-1.4.1/src/include/fst/partition.h +*** openfst-1.4.1.orig/src/include/fst/partition.h 2014-04-29 18:15:17.000000000 -0400 +--- openfst-1.4.1/src/include/fst/partition.h 2015-02-28 14:11:39.271566087 -0400 +*************** +*** 43,50 **** + friend class PartitionIterator<T>; + + struct Element { +! Element() : value(0), next(0), prev(0) {} +! Element(T v) : value(v), next(0), prev(0) {} + + T value; + Element* next; +--- 43,50 ---- + friend class PartitionIterator<T>; + + struct Element { +! Element() : value(0), next(0), prev(0) {} +! Element(T v) : value(v), next(0), prev(0) {} + + T value; + Element* next; +*************** +*** 52,60 **** + }; + + public: +! Partition() {} + +! Partition(T num_states) { + Initialize(num_states); + } + +--- 52,62 ---- + }; + + public: +! Partition(bool allow_repeated_split): +! allow_repeated_split_(allow_repeated_split) {} + +! Partition(bool allow_repeated_split, T num_states): +! allow_repeated_split_(allow_repeated_split) { + Initialize(num_states); + } + +*************** +*** 137,152 **** + if (class_size_[class_id] == 1) return; + + // first time class is split +! if (split_size_[class_id] == 0) + visited_classes_.push_back(class_id); +! + // increment size of split (set of element at head of chain) + split_size_[class_id]++; +! + // update split point +! if (class_split_[class_id] == 0) +! class_split_[class_id] = classes_[class_id]; +! if (class_split_[class_id] == elements_[element_id]) + class_split_[class_id] = elements_[element_id]->next; + + // move to head of chain in same class +--- 139,154 ---- + if (class_size_[class_id] == 1) return; + + // first time class is split +! if (split_size_[class_id] == 0) { + visited_classes_.push_back(class_id); +! class_split_[class_id] = classes_[class_id]; +! } + // increment size of split (set of element at head of chain) + split_size_[class_id]++; +! + // update split point +! if (class_split_[class_id] != 0 +! && class_split_[class_id] == elements_[element_id]) + class_split_[class_id] = elements_[element_id]->next; + + // move to head of chain in same class +*************** +*** 157,165 **** + // class indices of the newly created class. Returns the new_class id + // or -1 if no new class was created. + T SplitRefine(T class_id) { + // only split if necessary +! if (class_size_[class_id] == split_size_[class_id]) { +! class_split_[class_id] = 0; + split_size_[class_id] = 0; + return -1; + } else { +--- 159,169 ---- + // class indices of the newly created class. Returns the new_class id + // or -1 if no new class was created. + T SplitRefine(T class_id) { ++ ++ Element* split_el = class_split_[class_id]; + // only split if necessary +! //if (class_size_[class_id] == split_size_[class_id]) { +! if(split_el == NULL) { // we split on everything... + split_size_[class_id] = 0; + return -1; + } else { +*************** +*** 163,180 **** + split_size_[class_id] = 0; + return -1; + } else { +- + T new_class = AddClass(); + size_t remainder = class_size_[class_id] - split_size_[class_id]; + if (remainder < split_size_[class_id]) { // add smaller +- Element* split_el = class_split_[class_id]; + classes_[new_class] = split_el; +- class_size_[class_id] = split_size_[class_id]; +- class_size_[new_class] = remainder; + split_el->prev->next = 0; + split_el->prev = 0; + } else { +- Element* split_el = class_split_[class_id]; + classes_[new_class] = classes_[class_id]; + class_size_[class_id] = remainder; + class_size_[new_class] = split_size_[class_id]; +--- 167,189 ---- + split_size_[class_id] = 0; + return -1; + } else { + T new_class = AddClass(); ++ ++ if(allow_repeated_split_) { // split_size_ is possibly ++ // inaccurate, so work it out exactly. ++ size_t split_count; Element *e; ++ for(split_count=0,e=classes_[class_id]; ++ e != split_el; split_count++, e=e->next); ++ split_size_[class_id] = split_count; ++ } + size_t remainder = class_size_[class_id] - split_size_[class_id]; + if (remainder < split_size_[class_id]) { // add smaller + classes_[new_class] = split_el; + split_el->prev->next = 0; + split_el->prev = 0; ++ class_size_[class_id] = split_size_[class_id]; ++ class_size_[new_class] = remainder; + } else { + classes_[new_class] = classes_[class_id]; + class_size_[class_id] = remainder; + class_size_[new_class] = split_size_[class_id]; +*************** +*** 245,254 **** +--- 254,269 ---- + vector<T> class_size_; + + // size of split for each class ++ // in the nondeterministic case, split_size_ is actually an upper ++ // bound on the size of split for each class. + vector<T> split_size_; + + // set of visited classes to be used in split refine + vector<T> visited_classes_; ++ ++ // true if input fst was deterministic: we can make ++ // certain assumptions in this case that speed up the algorithm. ++ bool allow_repeated_split_; + }; + + diff --git a/sci-misc/openfst/openfst-1.4.1.ebuild b/sci-misc/openfst/openfst-1.4.1.ebuild new file mode 100644 index 000000000..a3eb530d5 --- /dev/null +++ b/sci-misc/openfst/openfst-1.4.1.ebuild @@ -0,0 +1,19 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="5" + +inherit eutils + +DESCRIPTION="Finite State Transducer tools by Google et al." +HOMEPAGE="http://www.openfst.org" +SRC_URI="http://www.openfst.org/twiki/pub/FST/FstDownload/${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +src_prepare() { + epatch "${FILESDIR}/kaldi-${P}.patch" +} |