Liqi's profileVictor's WorldPhotosBlogListsMore Tools Help

Liqi Gao

Occupation
Location
Interests
天资驽钝,好高骛远。年已弱冠,仍潜心学算,以期所成,达济天下。
Photo 1 of 27

Victor's World

小高爱生活
3/20/2008

准备写一个报告

又要写报告了,只有3天时间,很多东西要写,还要查很多东西。这个周末不休息了,拼了。这种生活很像在学校里的某些日子,和mentor讨论想法,拼命做实验,花心思组织数据、文字,耐心排版,熬夜写paper。虽然我不怎么擅长写论文,做项目多于写论文,但是从心底来说,还是喜欢做研究,喜欢做新的东西,喜欢做“有意义的”事情。“有意义的事就是好好活;好好活就是做很多很多有意义的事”。看似进入死循环的逻辑,细细品还是意味深长。尽管目前眼前有很多困难,我还是要好好“活”,以后做很多很多有意义的研究。好,伸伸懒腰,继续整报告。

Solving the 'computeBleu' problem in compiling SRILM on Windows

When I try to compile SRILM 1.5.6 on Windows in Visual Studio 2005 (http://www.inference.phy.cam.ac.uk/kv227/srilm/ ), a link error appears:
sri_oolm.lib(NBest.obj) : error LNK2001: unresolved external symbol "double __cdecl computeBleu(unsigned int,unsigned int * const,unsigned int * const,unsigned int,unsigned int)" (?computeBleu@@YANIQAI0II@Z)

The error reports that 'computeBleu' doesn't exist in sri_oolm.lib. Actually it's declared in ‘lm/src/Bleu.cc', which is not included in sri_oolm for some reason(maybe the SRILM 1.5.6 updated). Add these files to sri_oolm to solve the problem:
lm/src/Bleu.*
lm/src/LMClient.*
Then rebuild the sri_oolm and I got compiled programs successfully. Pretty lucky!

3/17/2008

从C++到Java -- 基本数据结构

注: 本来打算写给熟悉C++、刚接触Java的师弟,让他快速入门。结果...这小子学的比较快,省得我写了。翻箱倒柜找出来这些文字,权当备忘。

1.1.    int, double

C++中只有int, double这样“原生数据类型”;Java中也有,除此之外,还有IntegerDouble这样的“类”。以整型Integer为例,它的好处是,Integer继承自对象Object,能够存放在容器中。而原生数据类型就不同了。这是由于Java中的templateC++template实现机制不同造成的。

使用Java的数据类的一个好处是,在做类型转换时,更方便、更安全。例如:double d=Double.valueOf(3.14159)

1.2.    字符串

C++中字符串常用stringJava对应的是String。用法类似。值得注意的是,string可以改变(比如追加字符串);而String是不能改变的。如果需要对一个字符串做修改,需要生成新的String

构造

string str(“Hello, World!”);

String str=new String(“Hello, World!”);

1.3.    vector

C++vector是最常用的容器之一,相当于数组。Java中的Vector与其类似:

构造

vector<int> vec;

Vector< Integer > vec = new Vector< Integer >();

遍历

for(size_t i=0; i<vec.size(); ++i)

{

       cout << vec[i] << endl;

}

for(int i=0; i<vec.size(); ++i)

{

       System.out.print(vec.get(i));

}

追加

vec.push_back(x);

vec.add(x);

1.4.    map

Java中的map是个抽象类,具体实现一般用HashMapTreeMap

构造

map<string, int> m_mapBasicWord;

HashMap<String, Integer> m_mapBasicWord;

遍历

map<string, int>::iterator i;

for(i=x.begin(); i!=x.end(); ++i)

{

       cout << i->first << "\t" << i->second << endl; // (key, value)

}

Map<String, Integer> m = new HashMap<String, Integer>();

Set<String> keys = m.keySet();

Iterator< String > iter = keys.iterator();

while( iter.hasNext() ) {

       String key = iter.next();

       System.out.println( key + "\t" + m.get(key) );

}

判断是否存在

if( m.count(x) > 0 ) {...}

if( m.containsKey(key) ) {...}

取值

int y=m[x];

Integer y=m.get(x);

增加

m[x]=y;

m.put(x, y);

1.5.    set

类似map。建议参考JDK手册。

语言模型工具SRILM 的 Visual Studio 工程文件

一直在 Linux 下用 IRSTLM 语言模型(language mode)工具,主要原因是它与 Moses 配合的比较好,并且能够处理较大规模的数据(比如LDC Google的5-grams)。最近想在 Windows 开发一些应用,需要用到语言模型,研究了一番,决定放弃 IRSTLM——它用到 Linux 的 memory map 的 API,不支持跨平台。好在有一个比IRSTLM 名气更大的语言模型工具——SRILM (http://www.speech.sri.com/projects/srilm/ )。而且还有人公开了SRILM 的 solution 文件,相当攒人品,赞一个。参见 Building SRILM on Windows using Visual Studio (http://www.inference.phy.cam.ac.uk/kv227/srilm/ )。

下载下来准备试试。

3/27/2007

又买了几本书

又买了几本书:《西班牙旅行笔记》《一路走来一路读》《扫过落叶好过冬》。林达的。我是不是已经成了林达的fans?以前还买了《带一本书去巴黎》,《历史深处的忧虑》和《我也有一个梦想》。喜欢看林达的书,是因为能够通过他的文字,感受另一个国家的风土人情,另一种文化的神奇奥妙,另一个世界的人情世故。林达是两个人的笔名,生活在美国,足迹也遍布欧罗巴。想想真是羡慕,这才是生活。我的梦想之一,就是携着心爱的人,一起周游世界。不知道什么时候会实现。相信一定会的。

 
There are no music lists on this space.
by 
by 
by 
by