Skip to content

Instantly share code, notes, and snippets.

@knzm
Created March 8, 2012 07:02
Show Gist options
  • Save knzm/1999304 to your computer and use it in GitHub Desktop.
Save knzm/1999304 to your computer and use it in GitHub Desktop.
kytea patch
diff --git a/src/include/kytea/general-io.h b/src/include/kytea/general-io.h
index bf167cc..c1caadf 100644
--- a/src/include/kytea/general-io.h
+++ b/src/include/kytea/general-io.h
@@ -101,7 +101,7 @@ public:
void openFile(const char* file, bool out, bool bin) {
std::fstream::openmode mode = (out?std::fstream::out:std::fstream::in);
- if(bin) out = out | std::fstream::binary;
+ if(bin) mode = mode | std::fstream::binary;
std::fstream * str = new std::fstream(file, mode);
if(str->fail())
THROW_ERROR("Couldn't open file '"<<file<<"' for "<<(out?"output":"input"));
diff --git a/src/include/kytea/kytea-struct.h b/src/include/kytea/kytea-struct.h
index 88e1825..40b4ce6 100644
--- a/src/include/kytea/kytea-struct.h
+++ b/src/include/kytea/kytea-struct.h
@@ -28,7 +28,11 @@
// maps for use with various classes
#ifdef HAVE_TR1_UNORDERED_MAP
+#if _MSC_VER >=1600
+# include <unordered_map>
+#else
# include <tr1/unordered_map>
+#endif
template <class T>
class StringMap : public std::tr1::unordered_map<std::string,T> { };
template <class T>
diff --git a/src/lib/kytea.cpp b/src/lib/kytea.cpp
index 86bd8ea..89a1773 100644
--- a/src/lib/kytea.cpp
+++ b/src/lib/kytea.cpp
@@ -80,7 +80,6 @@ void Kytea::scanDictionaries(const vector<string> & dict, typename Dictionary<En
cerr << "Reading dictionary from " << *it << " ";
CorpusIO * io = CorpusIO::createIO(it->c_str(), CORP_FORMAT_FULL, *config, false, util);
io->setNumTags(config_->getNumTags());
- ifstream dis(it->c_str());
KyteaSentence* next;
int lines = 0;
while((next = io->readSentence())) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment