@@ -41,14 +41,14 @@ def _load_from_structure(self, path: Path) -> TextualData:
4141 # Load raw data from files
4242 terms_data = self ._load_json (path / "terms.json" )
4343 documents_data = self ._load_jsonl (path / "documents.jsonl" )
44- term_to_documents_data = self ._load_json (path / "terms2documents.json" )
44+ term2documents_data = self ._load_json (path / "terms2documents.json" )
4545
4646 terms = [Term (** t ) for t in terms_data ]
4747 documents = [Document (** d ) for d in documents_data ]
4848
49- term_to_documents = {}
50- for term_name , doc_entries in term_to_documents_data .items ():
51- term_to_documents [term_name ] = [
49+ term2documents = {}
50+ for term_name , doc_entries in term2documents_data .items ():
51+ term2documents [term_name ] = [
5252 DocumentReference (
5353 doc_id = entry ["doc_id" ],
5454 extraction_method = entry ["extraction_method" ]
@@ -59,7 +59,7 @@ def _load_from_structure(self, path: Path) -> TextualData:
5959 return TextualData (
6060 terms = terms ,
6161 documents = documents ,
62- term_to_documents = term_to_documents
62+ term2documents = term2documents
6363 )
6464
6565 @staticmethod
@@ -88,7 +88,7 @@ def get_terms_by_document(self, doc_id: Union[int, str], split: str) -> List[Ter
8888 term_list = []
8989 doc_id_str = str (doc_id )
9090
91- for term_name , doc_refs in self .data [split ].term_to_documents .items ():
91+ for term_name , doc_refs in self .data [split ].term2documents .items ():
9292 for doc_ref in doc_refs :
9393 if str (doc_ref .doc_id ) == doc_id_str :
9494 # Find the full term data
@@ -116,13 +116,13 @@ def get_statistics(self, split: str) -> Dict[str, Any]:
116116
117117 # Count documents per term
118118 docs_per_term = {
119- term .term : len (data .term_to_documents .get (term .term , []))
119+ term .term : len (data .term2documents .get (term .term , []))
120120 for term in data .terms
121121 }
122122
123123 # Get all unique document IDs that have terms
124124 docs_with_terms : Set [Union [int , str ]] = set ()
125- for refs in data .term_to_documents .values ():
125+ for refs in data .term2documents .values ():
126126 for ref in refs :
127127 docs_with_terms .add (ref .doc_id )
128128
0 commit comments