aboutsummaryrefslogtreecommitdiffstats
path: root/textproc
diff options
context:
space:
mode:
authordemon <demon@FreeBSD.org>2014-09-02 19:40:07 +0800
committerdemon <demon@FreeBSD.org>2014-09-02 19:40:07 +0800
commit24d38ba8a5499473e798884ce6e9e916959915b7 (patch)
tree2d7764336c0a23be1d460767c7a65086b34b1163 /textproc
parent1af3d39e792f36d05e5fe381b34b4f30c3916f64 (diff)
downloadfreebsd-ports-gnome-24d38ba8a5499473e798884ce6e9e916959915b7.tar.gz
freebsd-ports-gnome-24d38ba8a5499473e798884ce6e9e916959915b7.tar.zst
freebsd-ports-gnome-24d38ba8a5499473e798884ce6e9e916959915b7.zip
Do it in more C++ way.
Diffstat (limited to 'textproc')
-rw-r--r--textproc/irstlm/Makefile2
-rw-r--r--textproc/irstlm/files/patch-src-interpolate-lm.cpp22
-rw-r--r--textproc/irstlm/files/patch-src-mdiadapt.cpp47
3 files changed, 19 insertions, 52 deletions
diff --git a/textproc/irstlm/Makefile b/textproc/irstlm/Makefile
index 5f889b5475f6..53496c06b6f9 100644
--- a/textproc/irstlm/Makefile
+++ b/textproc/irstlm/Makefile
@@ -3,7 +3,7 @@
PORTNAME= irstlm
PORTVERSION= 5.80.03
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= textproc
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR=${PORTNAME}/${PORTNAME}/${PORTNAME}-5.80
diff --git a/textproc/irstlm/files/patch-src-interpolate-lm.cpp b/textproc/irstlm/files/patch-src-interpolate-lm.cpp
index bfa9b5f47a08..82490ba6a1ab 100644
--- a/textproc/irstlm/files/patch-src-interpolate-lm.cpp
+++ b/textproc/irstlm/files/patch-src-interpolate-lm.cpp
@@ -1,27 +1,11 @@
---- src/interpolate-lm.cpp.orig 2014-09-01 15:59:41.000000000 +0400
-+++ src/interpolate-lm.cpp 2014-09-01 16:00:21.000000000 +0400
+--- src/interpolate-lm.cpp.orig 2012-10-02 11:06:58.000000000 +0400
++++ src/interpolate-lm.cpp 2014-09-02 14:42:03.000000000 +0400
@@ -230,7 +230,7 @@ int main(int argc, char **argv)
//Learning mixture weights
if (learn) {
- std::vector<float> p[N]; //LM probabilities
-+ std::vector<float> *p = new std::vector<float>[N]; //LM probabilities
++ std::vector< std::vector<float> > p(N); //LM probabilities
float c[N]; //expected counts
float den,norm; //inner denominator, normalization term
float variation=1.0; // global variation between new old params
-@@ -256,6 +256,7 @@ int main(int argc, char **argv)
- lstream >> token >> id >> newlm;
- if(id <= 0 || id > N) {
- std::cerr << "LM id out of range." << std::endl;
-+ delete[] p;
- return 1;
- }
- id--; // count from 0 now
-@@ -318,6 +319,7 @@ int main(int argc, char **argv)
- outtxt << "LMINTERPOLATION " << N << "\n";
- for (int i=0; i<N; i++) outtxt << w[i] << " " << lmf[i] << "\n";
- outtxt.close();
-+ delete[] p;
- }
-
- for(int i = 0; i < N; i++)
diff --git a/textproc/irstlm/files/patch-src-mdiadapt.cpp b/textproc/irstlm/files/patch-src-mdiadapt.cpp
index 73fa1d1c5106..6d66784c84af 100644
--- a/textproc/irstlm/files/patch-src-mdiadapt.cpp
+++ b/textproc/irstlm/files/patch-src-mdiadapt.cpp
@@ -1,54 +1,37 @@
---- src/mdiadapt.cpp.orig 2014-09-01 15:41:52.000000000 +0400
-+++ src/mdiadapt.cpp 2014-09-01 15:46:52.000000000 +0400
-@@ -1170,7 +1170,7 @@ int mdiadaptlm::saveBIN_per_word(char *f
+--- src/mdiadapt.cpp.orig 2012-10-26 22:43:50.000000000 +0400
++++ src/mdiadapt.cpp 2014-09-02 15:33:55.000000000 +0400
+@@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fi
+ #include <cmath>
+ #include <string>
+ #include <assert.h>
++#include <vector>
+ #include "util.h"
+ #include "mfstream.h"
+ #include "mempool.h"
+@@ -1170,7 +1171,7 @@ int mdiadaptlm::saveBIN_per_word(char *f
}
- streampos pos[lmsize()+1];
-+ streampos *pos = new streampos[lmsize()+1];
++ vector<streampos> pos(lmsize()+1);
int maxlev=lmsize();
char buff[100];
int isQuant=0; //savebin for quantized LM is not yet implemented
-@@ -1385,7 +1385,7 @@ int mdiadaptlm::saveBIN_per_word(char *f
- out.seekp(pos[i]);
- out << buff;
- }
--
-+ delete[] pos;
- out.close();
-
- //concatenate files for each single level into one file
-@@ -1420,7 +1420,7 @@ int mdiadaptlm::saveBIN_per_level(char *
+@@ -1420,7 +1421,7 @@ int mdiadaptlm::saveBIN_per_level(char *
VERBOSE(2,"savebin: " << filename << "\n");
}
- streampos pos[lmsize()+1];
-+ streampos *pos = new streampos[lmsize()+1];
++ vector<streampos> pos(lmsize()+1);
int maxlev=lmsize();
char buff[100];
int isQuant=0; //savebin for quantized LM is not yet implemented
-@@ -1583,6 +1583,7 @@ int mdiadaptlm::saveBIN_per_level(char *
- out << buff;
- }
- out.close();
-+ delete[] pos;
-
- //concatenate files for each single level into one file
- //single level files should have a name derived from "filename"
@@ -1803,7 +1804,7 @@ int mdiadaptlm::saveARPA_per_level(char
fstream out(filename,ios::out);
// out.precision(15);
- streampos pos[lmsize()+1];
-+ streampos *pos = new streampos[lmsize()+1];
++ vector<streampos> pos(lmsize()+1);
table_entry_pos_t num[lmsize()+1];
char buff[100];
-@@ -1955,6 +1956,7 @@ int mdiadaptlm::saveARPA_per_level(char
- out << buff;
- }
-
-+ delete[] pos;
- out.seekp(last);
- out << "\\end\\" << "\n";
- system("date");