[mlpack] 152/207: treat \t and space as same category

Barak A. Pearlmutter barak+git at pearlmutter.net
Thu Mar 23 17:53:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch master
in repository mlpack.

commit f5ecb509a395a836d9cc2d6b6780de329a439a86
Author: stereomatchingkiss <stereomatchingkiss at gmail.com>
Date:   Sun Jun 5 13:43:47 2016 +0800

    treat \t and space as same category
---
 src/mlpack/core/data/load_csv.hpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/core/data/load_csv.hpp b/src/mlpack/core/data/load_csv.hpp
index 44ffa58..79be658 100644
--- a/src/mlpack/core/data/load_csv.hpp
+++ b/src/mlpack/core/data/load_csv.hpp
@@ -171,8 +171,13 @@ private:
     };
     auto setCharClass = [&](iter_type const &iter)
     {
+      std::string str = std::string(iter.begin(), iter.end());
+      if(str == "\t")
+      {
+        str.clear();
+      }
       inout(row, col++) =
-          static_cast<T>(infoSet.MapString(std::string(iter.begin(), iter.end()),
+          static_cast<T>(infoSet.MapString(std::move(str),
                                            row));
     };
 
@@ -256,8 +261,13 @@ private:
       if(mapCols.find(progress) != std::end(mapCols))
       {
         //std::cout<<"nstr("<<std::string(iter.begin(), iter.end())<<"),";
+        std::string str = std::string(iter.begin(), iter.end());
+        if(str == "\t")
+        {
+          str.clear();
+        }
         inout(row, col) =
-            static_cast<T>(infoSet.MapString(std::string(iter.begin(), iter.end()),
+            static_cast<T>(infoSet.MapString(std::move(str),
                                              progress));
       }
       else

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list