smart.pm
来自「AI::Categorizer is a framework for autom」· PM 代码 · 共 34 行
PM
34 行
package AI::Categorizer::Document::SMART;use strict;use AI::Categorizer::Document;use base qw(AI::Categorizer::Document);sub parse { my ($self, %args) = @_; $args{content} =~ s{ ^(?:\.I)?\s+(\d+)\n # ID number - becomes document name \.C\n ([^\n]+)\n # Categories \.T\n (.+)\n+ # Title \.W\n } {}sx or die "Malformed record: $args{content}"; my ($id, $categories, $title) = ($1, $2, $3); $self->{name} = $id; $self->{content} = { title => $title, body => $args{content} }; my @categories = $categories =~ m/(.*?)\s+\d+[\s;]*/g; @categories = map AI::Categorizer::Category->by_name(name => $_), @categories; $self->{categories} = \@categories;}1;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?