reflexive 1.2.3__tar.gz → 1.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {reflexive-1.2.3 → reflexive-1.2.4}/PKG-INFO +1 -1
- {reflexive-1.2.3 → reflexive-1.2.4}/pyproject.toml +1 -1
- {reflexive-1.2.3 → reflexive-1.2.4}/src/reflexive/analyse.py +1 -1
- {reflexive-1.2.3 → reflexive-1.2.4}/src/reflexive/res.py +74 -3
- {reflexive-1.2.3 → reflexive-1.2.4}/src/reflexive/session.py +1 -1
- {reflexive-1.2.3 → reflexive-1.2.4}/src/reflexive/util.py +1 -1
- {reflexive-1.2.3 → reflexive-1.2.4}/.gitignore +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/LICENSE +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/README.md +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.13-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.13.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.14-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.14.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.15-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.15.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.16-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.16.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.17-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.17.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.18-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.18.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.19-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.19.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.20-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.0.20.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.1.0-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.1.0.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.1.1-py3-none-any.whl +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/old reflexive dist/reflexive-1.1.1.tar.gz +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/pixi.lock +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/src/reflexive/__init__.py +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/src/reflexive/cfg.py +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/src/reflexive/visualise.py +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/tests/__init__.py +0 -0
- {reflexive-1.2.3 → reflexive-1.2.4}/tests/test_reflexive.py +0 -0
|
@@ -117,10 +117,81 @@ class Res_display:
|
|
|
117
117
|
html_out = displacy.render(disp_data,manual=True,style="ent", options=self.res_analyse.config.display_options,page=True,jupyter=False)
|
|
118
118
|
return html_out
|
|
119
119
|
|
|
120
|
-
def
|
|
120
|
+
def get_interactions(self,df:DataFrame) -> DataFrame:
|
|
121
121
|
#Get RE sequence
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
df = self._add_res_sequence(df)
|
|
123
|
+
df = self._add_res_interactions(df)
|
|
124
|
+
df = self._add_res_adj_matrix(df)
|
|
125
|
+
return df
|
|
126
|
+
|
|
127
|
+
def show_graph(self,df:DataFrame,inline=True) -> str:
|
|
128
|
+
for am in df.res_adj_matrix:
|
|
129
|
+
g = RES_graph(am)
|
|
130
|
+
g.show()
|
|
131
|
+
return("nothing yet")
|
|
132
|
+
|
|
133
|
+
def _add_res_sequence(self,df):
|
|
134
|
+
temp_df = df.copy()
|
|
135
|
+
temp_df['res_sequence'] = temp_df.reflexive_expressions.apply(self._get_res_sequence)
|
|
136
|
+
return temp_df
|
|
137
|
+
|
|
138
|
+
def _add_res_interactions(self,df):
|
|
139
|
+
temp_df = df.copy()
|
|
140
|
+
temp_df['res_interactions'] = temp_df.res_sequence.apply(self._count_res_interactions)
|
|
141
|
+
return temp_df
|
|
142
|
+
|
|
143
|
+
def _add_res_adj_matrix(self,df):
|
|
144
|
+
temp_df = df.copy()
|
|
145
|
+
temp_df['res_adj_matrix'] = temp_df.res_interactions.apply(self._create_adj_matrix)
|
|
146
|
+
return temp_df
|
|
147
|
+
|
|
148
|
+
def _get_res_sequence(self,reflexive_expressions):
|
|
149
|
+
re_seq = [label for re,label in reflexive_expressions]
|
|
150
|
+
res_seq = []
|
|
151
|
+
# Need to substitute new RES labels for old RE labels
|
|
152
|
+
for re in re_seq:
|
|
153
|
+
if re=='ER' or re=='VR':
|
|
154
|
+
res_seq.append('NR')
|
|
155
|
+
elif re=='EV':
|
|
156
|
+
res_seq.append('EP')
|
|
157
|
+
elif re=='CN':
|
|
158
|
+
res_seq.append('AF')
|
|
159
|
+
else:
|
|
160
|
+
res_seq.append(re)
|
|
161
|
+
return res_seq
|
|
162
|
+
|
|
163
|
+
def _empty_res_interactions(self) -> dict[tuple,int]:
|
|
164
|
+
RE_types = ['RR','NR','AR','AF','EP']
|
|
165
|
+
RE_interactions:dict[tuple,int] = dict()
|
|
166
|
+
for t1 in RE_types:
|
|
167
|
+
for t2 in RE_types:
|
|
168
|
+
entry = tuple(sorted((t1,t2)))
|
|
169
|
+
if entry not in RE_interactions.keys():
|
|
170
|
+
RE_interactions[entry] = 0
|
|
171
|
+
return RE_interactions
|
|
172
|
+
|
|
173
|
+
def _count_res_interactions(self,re_sequence:list[str]) -> dict[tuple,int]:
|
|
174
|
+
re_ints = self._empty_res_interactions()
|
|
175
|
+
limit = len(re_sequence)-1
|
|
176
|
+
for i,s in enumerate(re_sequence):
|
|
177
|
+
if i < limit:
|
|
178
|
+
rei = tuple(sorted((s,re_sequence[i+1])))
|
|
179
|
+
#print(i,rei)
|
|
180
|
+
re_ints[rei] += 1
|
|
181
|
+
return re_ints
|
|
182
|
+
|
|
183
|
+
def _create_adj_matrix(self,interactions:dict[tuple,int])->list[list[int]]:
|
|
184
|
+
re_types = ["RR","NR","AR","AF","EP"]
|
|
185
|
+
matrix = []
|
|
186
|
+
for r in re_types:
|
|
187
|
+
row = []
|
|
188
|
+
for c in re_types:
|
|
189
|
+
key = tuple(sorted((r,c)))
|
|
190
|
+
#print(key)
|
|
191
|
+
weight = interactions.get(key,0)
|
|
192
|
+
row.append(weight)
|
|
193
|
+
matrix.append(row)
|
|
194
|
+
return matrix
|
|
124
195
|
|
|
125
196
|
|
|
126
197
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|