Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl 为什么PodSpelling会抱怨一个被忽略的单词,如果它';文件名的一部分是什么?_Perl_Perl Pod - Fatal编程技术网

Perl 为什么PodSpelling会抱怨一个被忽略的单词,如果它';文件名的一部分是什么?

Perl 为什么PodSpelling会抱怨一个被忽略的单词,如果它';文件名的一部分是什么?,perl,perl-pod,Perl,Perl Pod,(通过Perlcritic运行)抱怨“html”,尽管我已将其添加到停止词中: =用于stopwords html =头2某些功能 生成index.html页面。 =切割 这将得到: robert@saaz:~$perlcritic--barroous test.pl | grep html 检查POD:html第1行第1列的拼写。见PBP第148页。(严重程度:1) (我通过grep传递输出,以忽略这个最小示例中与拼写无关的其他投诉。) 如果我将POD更改为使用C或F,或将其重写为a.ht

(通过Perlcritic运行)抱怨“html”,尽管我已将其添加到
停止词中:

=用于stopwords html
=头2某些功能
生成index.html页面。
=切割
这将得到:

robert@saaz:~$perlcritic--barroous test.pl | grep html
检查POD:html第1行第1列的拼写。见PBP第148页。(严重程度:1)
(我通过
grep
传递输出,以忽略这个最小示例中与拼写无关的其他投诉。)

如果我将POD更改为使用
C
F
,或将其重写为
a.html文件
,或添加“index.html”作为停止字,拼写检查器会很高兴。第一个对我来说是有意义的(不要检查代码片段或文件名),但我看不出“index.html”和“.html”之间有什么大区别

它是否与stopwords index.html的
=一起工作,因为它在空白处忽略了点?不过我只是在猜


为什么我的
stopword html
不适用于“index.html”,如果我不想使用
C
F
,我该如何解决这个问题?

Pod::Wordlist的作者就是这样实现的。他们希望确保像“e.g.”这样的缩写词将作为一个整体传递给拼写检查程序。 由于stopwords的拆分和剥离是在单词列表传递给拼写检查器之前完成的,所以不能同时进行。另一方面,默认的拼写检查器是
aspell
。在我看来,无论缩写词是否按句点拆分,都能通过检查

因此,您可以这样更改Pod/Wordlist.pm:

#line 129
sub _strip_a_word {
    my ($self, $word) = @_;
    my $remainder;

    # try word as-is, including possible hyphenation vs stoplist
    if ($self->is_stopword($word) ) {
        $remainder = '';
    }

        # check individual parts of hyphenated or period separated word,
        # keep whatever isn't a stopword as individual words
        # aspell will accept split words for abbreviations as well
        # 'e.g' passes like 'e g' does
    elsif ( $word =~ /-|\./ ) {
            my @keep;
            for my $part ( split /-|\./, $word ) {
                push @keep, $part if ! $self->is_stopword( $part );
            }
            $remainder = join(" ", @keep) if @keep;
    }
    # otherwise, we just keep it
    else {
        $remainder = $word;
    }
    return $remainder;
}