📄 reader.cpp
字号:
/* Text Clustering Copyright (C) 2004 Debora "Barbara" Donato, Antonio Gulli This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include "Reader.h"void simpleReader::loadDataSet(Clustering * algo){ string str; // a support string bool gotURL = false; // we need the url; algo->initDataSet(); // data set start up istream_iterator<string> string_itr(cin); do { // get from stin // word1 str = *string_itr; // word2 if (str != "quit"){ if (!gotURL && (str == "urlForClustering")){ // first in the format is the url ++string_itr; // next line is the url idToURL.push_back(*string_itr); // cout << "Got the url:" << *string_itr << "\n";; ++string_itr; // next lin str = *string_itr; // word gotURL = true; } if (str != "."){ // word3 // cout<< str << endl; // . (documents delimiter) algo->loadInDataSet(str); } else { // this document closed algo->finalizeLoadingDocument(); gotURL=false; } ++string_itr; // next word } } while (str != "quit"); // quit when receive "quit" all documents closed}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -