| Conditions | 3 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | #!/usr/bin/env python |
||
| 41 | @staticmethod |
||
| 42 | def mentions_from_JSON(jdict): |
||
| 43 | """ |
||
| 44 | Loads `processors.odin.Mention` from a dictionary of JSON data (`jdict`). |
||
| 45 | |||
| 46 | Parameters |
||
| 47 | ---------- |
||
| 48 | jdict : dict |
||
| 49 | A dictionary of JSON data encoding a list of `Mention`s and their corresponding `Document`s. |
||
| 50 | |||
| 51 | Returns |
||
| 52 | ------- |
||
| 53 | [processors.odin.Mention] |
||
| 54 | A list of `processors.odin.Mention` |
||
| 55 | """ |
||
| 56 | # build map of documents |
||
| 57 | docs_dict = {doc_id:Document.load_from_JSON(djson) for (doc_id, djson) in jdict["documents"].items()} |
||
| 58 | # deserialize mentions |
||
| 59 | mns_json = jdict["mentions"] |
||
| 60 | mentions = [] |
||
| 61 | for mjson in mns_json: |
||
| 62 | m = Mention.load_from_JSON(mjson, docs_dict) |
||
| 63 | mentions.append(m) |
||
| 64 | return mentions |
||
| 65 |