R阿斯佩尔自制软件

发布于 2024-11-25 04:54:47 字数 584 浏览 0 评论 0原文

在操作系统 10.6 的 Macbook pro 上工作。 我最近使用 R 包管理器安装了 Aspell 包,看起来安装进展顺利(没有安装错误)。但是当我尝试使用 aspell 时出现以下错误,

> aspell("love")
Error in getSpeller() :
  No word lists can be found for the language "en_US".

我也尝试

> aspell("love", program = "/usr/local/bin/aspell")

使用 GitHubs homebrew 分别安装了 aspell 和 hunspell。当我使用自制软件安装 aspell 时,我使用了

brew install aspell --lang=en_US

是否有地方可以在我的 mac 上搜索来仔细检查 en_US 语言是否已安装?如果我确实发现 en_US 在那里,是否有任何关于为什么 R 找不到它的建议?

当涉及到源文件的安装细节时,我有点新手。任何帮助将不胜感激。

working on a Macbook pro with OS 10.6.
I've recently installed the package Aspell with the R package manager and it appears the install went just fine (no install errors). but when I try to use aspell I get the following error,

> aspell("love")
Error in getSpeller() :
  No word lists can be found for the language "en_US".

I also tried

> aspell("love", program = "/usr/local/bin/aspell")

I also installed aspell and hunspell seperately using GitHubs homebrew. When I did install aspell with homebrew I used

brew install aspell --lang=en_US

Is there somewhere I search on my mac to double check that the en_US language was installed? And if I do find that en_US is there, are there any suggestions as to why R is not finding it?

I'm a bit of a newbie when it comes to installation subtleties from sources files. Any help would be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心凉 2024-12-02 04:54:47

如 aspell 公式底部所示,您可以使用 --with-lang-#{name} 选项。就我而言,我想安装多个词典:de, en &请。。我使用以下命令执行此操作:

brew install aspell --with-lang-de --with-lang-en --with-lang-pl

要查看所有可用的安装选项,请使用brew info aspell (感谢 Andrew)

本线程中提到的 --lang 选项与 --lang=de,en,pl 没有不适合我。

As shown at the bottom of the aspell formula, you can use a --with-lang-#{name} option. In my case, I wanted to install multiple dictionaries: de, en & pl. I did that with this command:

brew install aspell --with-lang-de --with-lang-en --with-lang-pl

To view all available install options use brew info aspell (Thanks Andrew)

The --lang option mentioned in this thread with --lang=de,en,pl didn't work for me.

感性 2024-12-02 04:54:47

已经过去了很多时间,但我最近遇到了同样的问题,解决方法是:

brew remove aspell
brew install aspell --lang=en

当它在原始的brew安装中飞过时,我应该更加仔细地注意:

词典不会自动安装,请指定
您想要为其安装词典的语言
--lang选项,例如:%brew install aspell --lang=en,es

对于以下语言,可以使用拼写词典:af、am、
ar、ast、az、be、bg、bn、br、ca、cs、csb、cy、da、de、de_alt、el、en、
eo、es、et、fa、fi、fo、fr、fy、ga、gd、gl、grc、gu、gv、he、hi、hil、
hr、hsb、hu、hy、ia、id、is、it、kn、ku、ky、la、lt、lv、mg、mi、mk、
ml、mn、mr、ms、mt、nb、nds、nl、nn、ny、或、pa、pl、pt_BR、pt_PT、qu、
ro、ru、rw、sc、sk、sl、sr、sv、sw、ta、te、tet、tk、tl、tn、tr、英国、
uz、vi、wa、yi、zu

A lot of time has gone by, but I recently had the same problem and the fix was:

brew remove aspell
brew install aspell --lang=en

I should have paid more careful attention when this flew by in the original brew install:

Dictionaries are not automatically installed, please specify the
languages for which you want dictionaries to be installed with the
--lang option, e.g: % brew install aspell --lang=en,es

For the following languages aspell dictionaries are available: af, am,
ar, ast, az, be, bg, bn, br, ca, cs, csb, cy, da, de, de_alt, el, en,
eo, es, et, fa, fi, fo, fr, fy, ga, gd, gl, grc, gu, gv, he, hi, hil,
hr, hsb, hu, hy, ia, id, is, it, kn, ku, ky, la, lt, lv, mg, mi, mk,
ml, mn, mr, ms, mt, nb, nds, nl, nn, ny, or, pa, pl, pt_BR, pt_PT, qu,
ro, ru, rw, sc, sk, sl, sr, sv, sw, ta, te, tet, tk, tl, tn, tr, uk,
uz, vi, wa, yi, zu

春花秋月 2024-12-02 04:54:47

我不明白你在做什么。 aspell 是 utils 包中的一个函数,因此在 R 启动时默认加载。 aspell 的第一个参数是文件名,而不是文本向量。您可能需要安装 aspell 函数可以访问的字典。但在我的 Mac 上,我已经安装了多个版本(并且可能需要进行一些清理。)Omegahat 存储库也有一个使用 R 进行测试的版本。与 Aspell 的界面可能会尝试选择正确的语言。您可以使用 sessionInfo() 查看 R 认为正确的语言,并查看您的 LOCALE 设置。您可以通过在命令提示符处输入 locate aspell 来使用 Terminal.app 查找 Aspell 安装的位置。

这是对 help(aspell) 中对 t*.dat 文件进行拼写检查的示例的修改:

files <- Sys.glob("~/t*.dat")
 res <- aspell(files)
 str(res)
 length(res$File)
#[1] 309    # so I probably should have been more narrow than asking for .dat files beginning with "t".

I don't understand what you are doing. aspell is a function in the utils package and is, therefore, loaded by default when R is started up. The first argument to aspell is a file name, not a text vector. You may need to install a dictionary that the aspell function can access. But on my Mac I already have several versions installed (and may need to do some cleaning.) The Omegahat repository also has one that is tested with R. The interface with Aspell will probably be attempting to select the correct language. You can see what R thinks is the correct language with sessionInfo() and look at your LOCALE settings. You can find the location of your Aspell installation with Terminal.app by entering locate aspell at the command prompt.

This is a modification of the example in help(aspell) that spell-checks t*.dat files:

files <- Sys.glob("~/t*.dat")
 res <- aspell(files)
 str(res)
 length(res$File)
#[1] 309    # so I probably should have been more narrow than asking for .dat files beginning with "t".
荒路情人 2024-12-02 04:54:47

请注意,aspell() 适用于因子,但不适用于字符向量。直到安装了 Aspell(或其他拼写检查器)后,这才会有帮助,但之后如果您想对 R 中的数据使用 aspell() (而不仅仅是处理文件),请确保它的格式正确。

这是一个例子:

> str1 <- "This is a string with a mispeled word"
> str1 <- as.character(str1)
> aspell(str1)
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'This is a string with a mispeled word': No such file or directory
> str1 <- "This is a string with a mispelled word"
> str1 <- as.factor(str1)
> results1 <- aspell(str1)
> results1 
mispelled
  <unknown>:1:25

As a note, aspell() works with factors but not character vectors. This won't help til after you have Aspell (or another spell checker) installed, but afterwards if you want to use aspell() on data in R (instead of just working on files), make sure it's properly formatted.

Here's an example:

> str1 <- "This is a string with a mispeled word"
> str1 <- as.character(str1)
> aspell(str1)
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'This is a string with a mispeled word': No such file or directory
> str1 <- "This is a string with a mispelled word"
> str1 <- as.factor(str1)
> results1 <- aspell(str1)
> results1 
mispelled
  <unknown>:1:25
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文