2009-04-10から1日間の記事一覧

年ごとに頻度の高い単語をファイルに出力する

C++

#include <iostream> #include <fstream> #include <string> #include <vector> #include <map> #include <mecab.h> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/path.hpp> #include <boost/filesystem/fstream.hpp> using namespace std; using namespace boost::filesystem; typedef map</boost/filesystem/fstream.hpp></boost/filesystem/path.hpp></boost/filesystem/operations.hpp></mecab.h></map></vector></string></fstream></iostream>

boostでディレクトリにあるファイル一覧を得る

エラー処理とかしてないけど、とりあえずこれでよし。 #include <iostream> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/path.hpp> #include <boost/filesystem/fstream.hpp> using namespace std; using namespace boost::filesystem; int main(void) { path fullPath = complete(path("/Users/yasuhisa/dbcls/pne/year…</boost/filesystem/fstream.hpp></boost/filesystem/path.hpp></boost/filesystem/operations.hpp></iostream>

ふつーの日記

何か上を見ていると、重複の多いコードばっかりのエントリが並んでいて自分もよく分からない感じになっているけど、面倒なので放置しておこうと思う。そんなわけでDBCLSに朝からバイトに行きまして、C++にいじめられて、夜はid:suztomo宅にてid:hayamizとid:…

C++で単語の登場回数を数える

C++

昨日Rでおわたになっていたので、C++でリベンジマッチをするべく準備を進める。 #include <fstream> #include <string> #include <vector> #include <map> #include <iostream> #include <mecab.h> using namespace std; vector<string> split( string s, string c ){ vector<string> ret; for( int i=0, n; i <= s.length(); i</string></string></mecab.h></iostream></map></vector></string></fstream>…