Skip to content

Instantly share code, notes, and snippets.

@chrislloyd
Created June 1, 2011 07:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chrislloyd/1001907 to your computer and use it in GitHub Desktop.
Save chrislloyd/1001907 to your computer and use it in GitHub Desktop.
require 'logger'
class String
LOGGER = Logger.new($stderr)
def -@; LOGGER.info self; end
end
# Extracted earlier, hardcoded for speed
ENTITIES = %w(I-ORG O I-MISC I-PER I-LOC B-LOC B-MISC MO B-ORG)
- 'started parsing training data'
TRAINING_DATA = CONLL03.parse_file(STDIN)
- 'finished parsing training data'
model = Perceptron.new ENTITIES, CONLL03.labels
@edzhelyov
Copy link

:o
How that -@ works in front of the string ?

@chrislloyd
Copy link
Author

def -@; end defines the minus operator. It's defined on all numbers so you can do - 1. You can also define +@!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment