Permalink
Browse files

Removed a lot of unneeded code.

  • Loading branch information...
1 parent cf40550 commit f0162bb48690fed69696a82ffd5b2f063087809b @joshuaeckroth joshuaeckroth committed Feb 8, 2013
Showing with 12 additions and 3,031 deletions.
  1. +11 −27 AINews.py
  2. +0 −23 AINewsConfig.py
  3. +0 −44 AINewsEmail.php
  4. +0 −340 AINewsParser.py
  5. +0 −63 AINewsParserExperiment.py
  6. +0 −300 AINewsPmwiki.php
  7. +1 −2 AINewsPublisher.py
  8. +0 −58 AINewsSVMAnalyzer.py
  9. +0 −260 AINewsSVMClassifier.py
  10. +0 −1,914 AINewsSourceParser.py
View
@@ -14,29 +14,23 @@
from AINewsConfig import config, paths
from AINewsCrawler import AINewsCrawler
from AINewsPublisher import AINewsPublisher
-from AINewsSVMClassifier import AINewsSVMClassifier
def usage():
"""
Print out the command-line usage of AINews.py.
"""
- usage = """ AINews Finder
+ usage = """ NewsFinder
USAGE:
python AINews.py COMMAND [OPTION]
COMMAND:
(1) crawl:
- crawl latest news from outside web.
+ Crawl latest news from outside web.
- (2) train:
- train news classifiers based on human rates.
-
- (3) publish:
- publish news from output files to Pmwiki site and send emails.
- It is weekly publish to the public.
-
- View Latest news at:
- http://www.aaai.org/AITopics/AINews
-
+ (2) prepare:
+ Filter and process the news, and create an XML export.
+
+ (3) email:
+ Generate an email form for submitting the weekly alert.
"""
print usage
@@ -47,10 +41,6 @@ def crawl(opts):
crawler.fetch_all_sources(opts)
crawler.fetch_all_articles()
-def train():
- svm = AINewsSVMClassifier()
- svm.train('db:cat_corpus:cat_corpus_cats')
-
def prepare():
publisher = AINewsPublisher()
publisher.filter_and_process()
@@ -61,29 +51,24 @@ def email():
publisher.publish_email_semiauto()
def main():
- """
- Main function of AINews.py
- """
# Set en_US, UTF8
locale.setlocale(locale.LC_ALL,'en_US.UTF-8')
- commands_list = ("train", "crawl", "prepare", "email", "help")
+ commands_list = ("crawl", "prepare", "email", "help")
try:
if len(sys.argv) < 2 or sys.argv[1] not in commands_list:
usage()
sys.exit()
command = sys.argv[1]
- opts, args = getopt.getopt(sys.argv[2:], 'rf:u:s:', ['url=', 'file=', 'rss', 'source='])
+ opts, args = getopt.getopt(sys.argv[2:], 'rf:u:s:',
+ ['url=', 'file=', 'rss', 'source='])
except getopt.GetoptError, err:
# print help information and exit:
print str(err) # will print something like "option -a not recognized"
usage()
sys.exit(2)
- if command == "train":
- train()
-
- elif command == "crawl":
+ if command == "crawl":
crawl(opts)
elif command == "prepare":
@@ -94,4 +79,3 @@ def main():
if __name__ == "__main__":
main()
-
View
@@ -51,29 +51,6 @@
stopwords.add(word.rstrip())
file.close()
-# aitopic_urls is used to assign each news to a category by comparing the
-# similarity with the following webpages.
-aitopic_urls = [
- "http://aaai.org/AITopics/AIOverview",
- "http://aaai.org/AITopics/Agents",
- "http://aaai.org/AITopics/Applications",
- "http://aaai.org/AITopics/CognitiveScience",
- "http://aaai.org/AITopics/Education",
- "http://aaai.org/AITopics/Ethics",
- "http://aaai.org/AITopics/Games",
- "http://aaai.org/AITopics/History",
- "http://aaai.org/AITopics/Interfaces",
- "http://aaai.org/AITopics/MachineLearning",
- "http://aaai.org/AITopics/NaturalLanguage",
- "http://aaai.org/AITopics/Philosophy",
- "http://aaai.org/AITopics/Reasoning",
- "http://aaai.org/AITopics/Representation",
- "http://aaai.org/AITopics/Robots",
- "http://aaai.org/AITopics/ScienceFiction",
- "http://aaai.org/AITopics/Speech",
- "http://aaai.org/AITopics/Systems",
- "http://aaai.org/AITopics/Vision"
- ]
"""
Regular expression used to extract the date from text
View
@@ -1,44 +0,0 @@
-<?php
-/*
- The AINewsEmail.php is used to send twice-monthly AINews notification for
- subscribers.
- It is called in the publish part in AINews.py.
-*/
-
-$paths = parse_ini_file("config/paths.ini", true);
-$config = parse_ini_file("config/config.ini", true);
-
-$AINEWS_DIR = $paths['ainews']['ainews_root'];
-$PMWIKI_DIR = $paths['pmwiki']['dir'];
-$OUTPUT_DIR = $paths['ainews']['output'];
-$filename = $OUTPUT_DIR."email_output.txt";
-
-$handle = fopen($filename, "r");
-// message
-$message = fread($handle, filesize($filename));
-fclose($handle);
-
-// multiple recipients
-$subscribers = $config['email']['subscribers'];
-$sub_array = explode(":", $subscribers);
-$to = "";
-
-foreach($sub_array as $sub){
- $to .= "$sub, ";
-}
-
-// subject
-$today = date("D, F j, Y");
-$subject = "Weekly AI Alert, $today";
-
-// To send HTML mail, the Content-type header must be set
-$headers = 'MIME-Version: 1.0' . "\r\n";
-$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
-
-// Additional headers
-$headers .= 'From: AI Alert<admin11@aaai.org>' . "\r\n";
-
-
-// Mail it
-print mail($to, $subject, $message, $headers);
-?>
Oops, something went wrong.

0 comments on commit f0162bb

Please sign in to comment.