Skip to content

Commit

Permalink
07 Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuoyuan yao committed Feb 21, 2020
1 parent 8912649 commit f7bc3d0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
22 changes: 20 additions & 2 deletions 07-LM/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# 第七章作业
请查看实验指导书了解实验内容
# 第七章作业
# 说明
请根据"实验指导书.pdf":part2.2和part4分别完场N-gram计数和Witten-Bell算法的编写。

编译文件:Makefile

# 提供的C++文件介绍:
1. main.C:入口函数
2. util.{H,C}:提供命令行解析,读取和写出数据等功能,不必仔细阅读,可以掠过。
3. lang_model.{H,C}:LM类定义,本实验主要部分内容,需要完成.C文件中count_sentence_ngrams()和get_prob_witten_bell()函数。
4. lab3_lm.{H,C}:语言模型实验的wrapper函数。

# 数据文件:
字典:lab3.syms
训练集:minitrain.txt和minitrain2.txt
测试集:test1.txt和test2.txt

# bash文件:
lab3_p1{a,b}.sh:测试N-gram计数
lab3_p3 {a,b}.sh:测试Witten-Bell smoothing算法
17 changes: 17 additions & 0 deletions 07-LM/lab3_p1a.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e


if [[ -e ./lab3_lm ]] ; then
binStr="./lab3_lm"
elif [[ -e Lab3Lm.class ]] ; then
binStr="java Lab3Lm"
else
echo "Couldn't find program to execute."
exit 1
fi


$binStr --vocab lab3.syms --train minitrain2.txt --test test1.txt \
--count_file p1a.counts


17 changes: 17 additions & 0 deletions 07-LM/lab3_p1b.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e


if [[ -e ./lab3_lm ]] ; then
binStr="./lab3_lm"
elif [[ -e Lab3Lm.class ]] ; then
binStr="java Lab3Lm"
else
echo "Couldn't find program to execute."
exit 1
fi


$binStr --vocab lab3.syms --train minitrain.txt --test test1.txt \
--count_file p1b.counts


0 comments on commit f7bc3d0

Please sign in to comment.