Skip to content

Instantly share code, notes, and snippets.

@maliabadi
Created February 5, 2013 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maliabadi/4711060 to your computer and use it in GitHub Desktop.
Save maliabadi/4711060 to your computer and use it in GitHub Desktop.
class DeclarativeMessage(Message):
__metaclass__ = _DeclarativeMeta
query = None
query_rows = 1 # most common case
role = None
processor = None
domain = None
range = None
rel_ = None
rel_kwargs = None
params = None
features = None
frequency = None
time = None
location = None
mixins = None
# approximate = None # .approximate exists... should be .add_approximate
def __init__(self, context, topic=None, **kwargs):
self.relations = []
self.topic = topic
self.context = copy(context) # so we can mutate w/out caring
self.semantic_element = None
if self.features is None:
self.features = get_features_frame()
else:
# don't overwrite the original
self.features = get_features_frame(self.features)
if self.rel_kwargs is None:
self.rel_kwargs = {}
else:
# don't overwrite the original
self.rel_kwargs = deepcopy(self.rel_kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment