Fix calculation of total token count

Change-Id: Ib8c2960f276107f7fe5dbf1699ff5b20f1315166
diff --git a/src/collocatordb.cc b/src/collocatordb.cc
index 2660346..e2d37d5 100644
--- a/src/collocatordb.cc
+++ b/src/collocatordb.cc
@@ -471,8 +471,7 @@
       exit(1);
     }
     uint64_t i = 0;
-    while (!feof(fin)) {
-      fscanf(fin, "%s %lu", strbuf, &freq);
+    while (fscanf(fin, "%s %lu", strbuf, &freq) == 2) {
       _vocab.push_back({strbuf, freq});
       total += freq;
       i++;