Skip to content

Instantly share code, notes, and snippets.

@madosuki
Last active October 2, 2019 08:23
Show Gist options
  • Save madosuki/261712bdde524bbe4b1fd977dbfcae4c to your computer and use it in GitHub Desktop.
Save madosuki/261712bdde524bbe4b1fd977dbfcae4c to your computer and use it in GitHub Desktop.
This diff file is patch for "YamCha: Yet Another Multipurpose CHunk Annotator" .
diff -uprN ../yamchaPre/libexec/pkemine.cpp ./libexec/pkemine.cpp
--- ../yamchaPre/libexec/pkemine.cpp 2004-03-13 02:12:13.000000000 +0900
+++ ./libexec/pkemine.cpp 2017-04-26 15:21:36.000000000 +0900
@@ -124,7 +124,7 @@ private:
int pos = projected[i].second;
unsigned int size = transaction[id].size();
for (unsigned int j = pos + 1; j < size; ++j)
- counter[transaction[id][j]].push_back (std::make_pair<unsigned int, int>(id, j));
+ counter[transaction[id][j]].push_back (std::make_pair<unsigned int, int>((const unsigned int)id, (const int)j));
}
for (std::map <unsigned int , std::vector <std::pair<unsigned int, int> > >::iterator
@@ -191,7 +191,7 @@ public:
std::fill (neg_num.begin(), neg_num.end(), 0);
for (unsigned int i = 0; i < transaction.size(); i++) {
- root.push_back (std::make_pair<unsigned int, int>(i, -1));
+ root.push_back (std::make_pair<unsigned int, int>((const unsigned int)i, (int)-1));
if (w[i] > 0) ++pos_num[cid[i]];
else ++neg_num[cid[i]];
}
diff -uprN ../yamchaPre/src/chunkersub.h ./src/chunkersub.h
--- ../yamchaPre/src/chunkersub.h 2005-09-05 23:50:59.000000000 +0900
+++ ./src/chunkersub.h 2017-04-26 13:10:32.050131400 +0900
@@ -54,7 +54,7 @@ namespace YamCha {
#ifdef _YAMCHA_PARSE_DETAIL
dist[i].push_back (std::make_pair <char*, double>
- (result[n].name, result[n].dist));
+ ((char*)result[n].name, (const double)result[n].dist));
#endif
if (! c[result[n].name]) continue;
@@ -71,7 +71,7 @@ namespace YamCha {
#ifdef _YAMCHA_PARSE_DETAIL
dist[i].push_back (std::make_pair <char*, double>
- (result[n].name, result[n].dist));
+ ((char*)result[n].name, (const double)result[n].dist));
#endif
if (max_score < result[n].score) {
diff -uprN ../yamchaPre/src/common.h ./src/common.h
--- ../yamchaPre/src/common.h 2005-09-05 23:50:59.000000000 +0900
+++ ./src/common.h 2017-04-25 16:10:37.217158500 +0900
@@ -51,6 +51,7 @@ Copyright (C) 2001-2004 Taku Kudo All ri
#include <vector>
#include <string>
#include <stdexcept>
+#include <cstring>
namespace YamCha {
diff -uprN ../yamchaPre/src/feature_index.cpp ./src/feature_index.cpp
--- ../yamchaPre/src/feature_index.cpp 2005-09-05 23:50:59.000000000 +0900
+++ ./src/feature_index.cpp 2017-04-26 12:39:28.324695900 +0900
@@ -147,11 +147,11 @@ namespace YamCha
if (rclist[0] == "F" || rclist[0] == "f") {
for (std::set<int>::iterator rit = tmp_row.begin(); rit != tmp_row.end(); ++rit)
for (std::set<int>::iterator cit = tmp_col.begin(); cit != tmp_col.end(); ++cit)
- feature_set.insert (std::make_pair <int, int>( *rit, *cit ) );
+ feature_set.insert (std::make_pair <int, int>( (const int)*rit, (const int)*cit ) );
} else {
for (std::set<int>::iterator rit = tmp_row.begin(); rit != tmp_row.end(); ++rit)
for (std::set<int>::iterator cit = tmp_col.begin(); cit != tmp_col.end(); ++cit)
- bow_feature_set.insert (std::make_pair <int, int>( *rit, *cit ) );
+ bow_feature_set.insert (std::make_pair <int, int>( (const int)*rit, (const int)*cit ) );
}
} else if (size == 2 && (rclist[0] == "T" || rclist[0] == "t")) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment