Ⅰ. 插件描述
Implementation of Porter stemming algorithm in vim scriptⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'msbmsb/porter-stem'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'msbmsb/porter-stem'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'msbmsb/porter-stem'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/msbmsb/porter-stem.vim
Ⅳ. 文档说明
PorterStem is a vim script that implements the Porter stemming algorithm, by Martin Porter, details of which can be found at: http://tartarus.org/~martin/PorterStemmer/
The main function outputs the single string of the stem, and the script only
echoes the output to the screen. This script, while it can be used as-is
if you want to know what the stem for a word is, is mostly a container for
the algorithm implementation in vim script.
PorterStem command syntax:
- :PorterStem (<word>)*
Each word input to the :PorterStem command will be stemmed and processed by
the ProcessStem function, that by default simply echoes to the screen.
Without any word given for input, it will attempt to stem the current word
under the cursor via expand('<cword>').
For example:
- :PorterStem searching
- output:
- search
- a string of words will work as well, matching in order:
- :PorterStem thieves are running from the bunny
- output:
- thiev are run from bunni
Running :PorterTest <test-file> <expected-results-file> will run each
word in <test-file> and match the stem result to the same line in the
<expected-results-file>, showing if any are incorrect stem matches.
Provided in the github repository are two files voc.txt and output.txt
from Martin Porter's site providing a set of test words.
To use this vim script, add it to ~/.vim/plugin/
See doc/porter-stem.vim.txt for more information about the script.
See http://github.com/msbmsb/stem-search.vim for a script that uses this method for reverse-stem searching in a file.