openIE 5的berkeley language model的生成

本文介绍如何从头构建Berkeley Language Model,包括下载Web1T文件及英语词汇表,获取语言模型jar包,并使用Java代码通过readGoogleLmBinary方法读取这些文件,最终生成6.4G的大文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

openIE 5需要下载Berkeley language model, 但是Github上给出的链接是google driver的,下载老是出错,加上文件很大,下载了两天基本都是失败。联系了作者,作者说可以用如下步骤生成。
详细步骤
1. Download the Web1T file and the vocabulary for English from  http://tomato.banatao.berkeley.edu:8080/berkeleylm_binaries/

2. Download the Language Model jar from the link you mentioned.

3. Read the files using the method  readGoogleLmBinary into a  Stupid Backoff Object. The source of the method is here - https://github.com/adampauls/berkeleylm/blob/master/src/edu/berkeley/nlp/lm/io/LmReaders.java

4. Serialize that object and you will get the 6.4G file that I uploaded.

使用readGoogleLmBinary into a Stupid Backoff Object的java代码:

import edu.berkeley.nlp.lm.io.LmReaders;
public class stupidOff {
	
	public static void main(String []args) {
		String file1="languageModel";
//		final WordIndexer<W> file2="en.blm Web1T";
		String file2="E://eclipse file//LmReaders//src//en.blm Web1T";
		String file3="E://eclipse file//LmReaders//src//vocab_cs  vocabulary for English";
//		edu.berkeley.nlp.lm.io.LmReaders.readGoogleLmBinary(file1, "en.blm Web1T", file3);
//		edu.berkeley.nlp.lm.io.LmReaders.readGoogleLmBinary(file1, file2, file3);
		edu.berkeley.nlp.lm.io.LmReaders.readGoogleLmBinary(file2, file3);
	}

}

文件放置图:





评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值