Changeset 44f585c
- Timestamp:
- Sep 20, 2011, 11:15:31 PM (13 years ago)
- Branches:
- master, release-1.10, release-1.9
- Children:
- 77d1ef1
- Parents:
- eb497a9
- git-author:
- Edward Z. Yang <ezyang@mit.edu> (06/20/11 12:03:35)
- git-committer:
- Edward Z. Yang <ezyang@mit.edu> (09/20/11 23:15:31)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/Facebook/lib/BarnOwl/Module/Facebook/Handle.pm
reb497a9 r44f585c 16 16 use Facebook::Graph; 17 17 18 use Lingua::EN::Keywords; 18 use List::Util qw(reduce); 19 20 eval { require Lingua::EN::Keywords; }; 21 if ($@) { 22 *keywords = sub { 23 # stupidly pick the longest one, and only return one. 24 my $sentence = shift; 25 $sentence =~ s/[[:punct:]]//g; 26 my @words = split(' ', lc($sentence)); 27 return () unless @words; 28 return (reduce{ length($a) > length($b) ? $a : $b } @words,); 29 }; 30 } else { 31 *keywords = \&Lingua::EN::Keywords::keywords; 32 } 19 33 20 34 use JSON;
Note: See TracChangeset
for help on using the changeset viewer.