Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #125 from stands4/master
Browse files Browse the repository at this point in the history
Abbreviations.com IA Fathead Plugin
  • Loading branch information
Jason committed Mar 24, 2015
2 parents 9b567ce + 5543f32 commit d20abf4
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/DDG/Fathead/Abbreviations.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package DDG::Fathead::Abbreviations;

use DDG::Fathead;

primary_example_queries "what does ASAP mean";

secondary_example_queries
"What does ASAP stand for",
"What is ASAP short for";

description "database of acronyms, abbreviations and meanings";

name "Abbreviations.com";

icon_url "/i/abbreviations.com.ico";

source "Abbreviations.com";

code_url "https://github.com/duckduckgo/zeroclickinfo-fathead/tree/master/share/fathead/abbreviation_com";

topics "everyday", "special_interest";

category "reference";

attribution
github => ['https://github.com/stands4', 'STANDS4'],
twitter => ['https://twitter.com/justadded', 'STANDS4'];

1;
3 changes: 3 additions & 0 deletions share/fathead/abbreviations_com/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Dependencies:

Python 2.6+
5 changes: 5 additions & 0 deletions share/fathead/abbreviations_com/fetch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

[ ! -e download ] && mkdir download

wget -P download -O download/abbr.txt -N 'http://www.abbreviations.com/root/admin/dumpduckexport.php'
15 changes: 15 additions & 0 deletions share/fathead/abbreviations_com/meta.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This is the name of the source as people would refer to it, e.g. Wikipedia or PerlDoc
Name: Abbreviations.com

# This is the base domain where the source pages are located.
Domain: www.abbreviations.com

# This is what gets put in quotes next to the source
# It can be blank if it is a source with completely general info spanning many types of topics like Facebook.
Type: Abbreviations.com

# Whether the source is from MediaWiki (1) or not (0).
MediaWiki: 0

# Keywords uses to trigger (or prefer) the source over others.
Keywords: acronym, abbreviation, shorthand, stands for, stand for, short for, means
29 changes: 29 additions & 0 deletions share/fathead/abbreviations_com/parse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python

def print_line(key, text, url):
print("\t".join([
key, #1
"A", #2
"", #3
"", #4
"", #5
"", #6
"", #7
"", #8
"", #9
"", #10
"", #11
text, #12
url])) #13

with open("download/abbr.txt") as f:
lines = f.readlines()

for line in lines:
fields = line.split("\t")

key = fields[0]
text = fields[1]
url = "http://www.abbreviations.com/%s" % (key)

print_line(key, text, url) #print entry
3 changes: 3 additions & 0 deletions share/fathead/abbreviations_com/parse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

./parse.py > output.txt

0 comments on commit d20abf4

Please sign in to comment.