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

Commit

Permalink
rename MetaInput to RawString
Browse files Browse the repository at this point in the history
Summary:
renaming MetaInput to RawString, and JsonMetaInput to RawJson.
These are pass-through Tokenizers that just copy their inputs.  The name
"MetaInput" does not mean anything, RawString and RawJson at least give you
a hint about what they're doing.

Differential Revision: D14654966

fbshipit-source-id: 315d9835196900a531bd445e313019eb5d868292
  • Loading branch information
Titousensei authored and facebook-github-bot committed Mar 27, 2019
1 parent 8f7ebb5 commit 8aa0d78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pytext/data/tensorizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def tensorize(self, batch):
return pad_and_tensorize(batch, dtype=torch.float)


class MetaInput(Tensorizer):
class RawString(Tensorizer):
"""A pass-through tensorizer to include raw fields from datasource in the batch.
Used mostly for metric reporting."""

Expand All @@ -358,7 +358,7 @@ def numberize(self, row):
return row[self.column]


class JsonMetaInput(MetaInput):
class RawJson(RawString):
def numberize(self, row):
return json.loads(row[self.column])

Expand Down
4 changes: 2 additions & 2 deletions pytext/models/doc_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from pytext.config.field_config import WordFeatConfig
from pytext.data.tensorizers import (
LabelTensorizer,
MetaInput,
NumericLabelTensorizer,
RawString,
Tensorizer,
TokenTensorizer,
)
Expand Down Expand Up @@ -59,7 +59,7 @@ class ModelInput(Model.Config.ModelInput):
tokens: TokenTensorizer.Config = TokenTensorizer.Config()
labels: LabelTensorizer.Config = LabelTensorizer.Config(allow_unknown=True)
# for metric reporter
raw_text: MetaInput.Config = MetaInput.Config(column="text")
raw_text: RawString.Config = RawString.Config(column="text")

inputs: ModelInput = ModelInput()
embedding: WordEmbedding.Config = WordEmbedding.Config()
Expand Down

0 comments on commit 8aa0d78

Please sign in to comment.