This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| The MIT License | |
| Copyright (c) 2011, Marcelo Criscuolo. | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Not today, Jimmy Wales! | |
| // @namespace http://jau.org/userscripts | |
| // @include http://*.wikipedia.org/* | |
| // @include http://*.wikiversity.org/* | |
| // ==/UserScript== | |
| /* | |
| Firefox: runs over GreaseMonkey or Scriptish |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #coding: utf-8 | |
| # Estimates the value of PI | |
| # Based on example described at http://code.google.com/edu/parallel/mapreduce-tutorial.html#Basics | |
| # Author: Marcelo Criscuolo (Jaú), with | |
| # invaluable contributions from Rafael Giusti (Argentino) | |
| import math | |
| from datetime import datetime | |
| RADIUS = 50000 # the bigger the number, more precise is the estimation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #coding: utf-8 | |
| # Estimates the value of PI | |
| # Based on example described at http://code.google.com/edu/parallel/mapreduce-tutorial.html#Basics | |
| # Author: Marcelo Criscuolo (Jaú), with | |
| # invaluable contributions from Rafael Giusti (Argentino) | |
| import math | |
| from datetime import datetime | |
| from multiprocessing import Pool, cpu_count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #coding: utf-8 | |
| """ | |
| Centroid-based Summarization | |
| [Jurafsky & Martin, 2nd ed, ch23, sec23.4.1] | |
| Author: Marcelo Criscuolo (criscuolo[dot]marcelo[at]gmail[dot]com) | |
| Date: 2013-07-19 | |
| """ | |
| from __future__ import print_function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ $# -lt 1 ]; then | |
| echo "usage: $0 <directory>" | |
| exit 1 | |
| fi | |
| TARGET_DIR=$1 | |
| echo "Running clamscan..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ -z "$1" ]; then | |
| echo "usage: `basename $0` <source-file> [output-file]" | |
| exit 1; | |
| fi | |
| output=$2 | |
| if [ -z "$2" ]; then | |
| output="pygmentized.rtf" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| import logging | |
| import random | |
| import numpy as np | |
| UNKNOWN = -1 | |
| NOT_FOUND = -1 | |
| MIN_SIMILARITY = 0.90 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def mycosine(v1, v2): | |
| """ | |
| Calcular o cosseno do ângulo theta, formado pelos vetores v1 e v2. | |
| """ | |
| raise NotImplementedError | |
| # -- BEGIN: não alterar -- | |
| try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| def main(): | |
| parser = argparse.ArgumentParser( | |
| description='Compute precision at k.') | |
| parser.add_argument( | |
| '-k', help='k, to compute precision@k', type=int, default=1) | |
| parser.add_argument('qrels', help='TREC relevance file (qrels)') | |
| parser.add_argument('topfile', help='TREC results file') |