如何将一个Notepad txt扩展语料库加载到CSharp? [英] How do I load a corpus of Notepad txt extension to CSharp?
本文介绍了如何将一个Notepad txt扩展语料库加载到CSharp?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在非英语Langange建立了一个语料库。语料库在记事本文本文件中。如何将其与CSharp连接?
我想制作一个用于快速搜索和信息检索的软件。
解决方案
如果您想开发一个快速搜索和信息检索的软件,那么您需要做很多工作,并且使用C#读取该文本文件 - 程序是其中最不具挑战性的任务之一。我建议你在网上寻找一些C#教程和/或购买一些好书并从小开始。
但是,用C#读取文本文件很简单:
string fileName = yourTextFile.txt跨度>;
string corpus;
使用( var reader = new StreamReader(File.Open(fileName,FileMode.Open)))
{
corpus = reader.ReadToEnd();
}
// todo:processcorpus
I have build a corpus in non-english Langange. The Corpus is in Notepad text file. How do I connect it with CSharp?
I want to make a software for fast searching and information retrieval.
解决方案
If you want to develop a software for fast searching and information retrieval you have a LOT of work before you and reading that text file with a C#-Program is one of the LEAST challenging tasks thereof. I suggest you look for some C#-Tutorials on the Web and/or buy some good books and start small.
However, reading a text file with C# is simple:
string fileName = "yourTextFile.txt"; string corpus; using (var reader = new StreamReader(File.Open(fileName, FileMode.Open))) { corpus = reader.ReadToEnd(); } // todo: process "corpus"
这篇关于如何将一个Notepad txt扩展语料库加载到CSharp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文