summaryrefslogtreecommitdiffstats
path: root/fsa/queryproc/sort_grams.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fsa/queryproc/sort_grams.cpp')
-rw-r--r--fsa/queryproc/sort_grams.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/fsa/queryproc/sort_grams.cpp b/fsa/queryproc/sort_grams.cpp
new file mode 100644
index 00000000000..427dba129ff
--- /dev/null
+++ b/fsa/queryproc/sort_grams.cpp
@@ -0,0 +1,29 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <iostream>
+#include <iomanip>
+
+#include "permuter.h"
+#include "ngram.h"
+#include "base64.h"
+#include "wordchartokenizer.h"
+
+using namespace fsa;
+
+int main(int argc, char **argv)
+{
+
+ NGram query;
+ WordCharTokenizer tokenizer(WordCharTokenizer::PUNCTUATION_WHITESPACEONLY);
+ std::string qstr;
+
+ while(!std::cin.eof()){
+ getline(std::cin,qstr);
+ query.set(qstr,tokenizer,0,-1);
+ query.sort();
+ query.uniq();
+ std::cout << query << std::endl;
+ }
+
+
+ return 0;
+}