query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
A posteriori SNR estimate.
def gamma_hat(self, xi_gamma_bar_hat): _, gamma_bar_hat = tf.split(xi_gamma_bar_hat, num_or_size_splits=2, axis=-1) gamma_hat = self.gamma_map.inverse(gamma_bar_hat) return gamma_hat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SNR(S, S0):\n return np.var(S) / np.var(S - S0)", "def calculateSNR(self):\n pass", "def get_S_r(self):\n\n S_r = np.sum((self.eta_model - self.eta_exp) ** 2.)\n\n return S_r", "def rsr(self) -> float:\n return float(self.rmse() / np.std(self.true))", "def psnr(y_true, y_pred):\n...
[ "0.6921239", "0.6244635", "0.6144825", "0.6120464", "0.6095354", "0.60743237", "0.5972495", "0.59635097", "0.59581226", "0.5924699", "0.59187704", "0.5913058", "0.5862083", "0.5802056", "0.5787848", "0.5745068", "0.5743066", "0.5743066", "0.5688942", "0.5688405", "0.56845427"...
0.0
-1
Compute example for Deep Xi, i.e. observation (noisyspeech STMS) and target (gain).
def example(self, s, d, s_len, d_len, snr): s, d, x, n_frames = self.mix(s, d, s_len, d_len, snr) s_STMS, _ = self.polar_analysis(s) d_STMS, _ = self.polar_analysis(d) x_STMS, _ = self.polar_analysis(x) xi = self.xi(s_STMS, d_STMS) # instantaneous a priori SNR. gamma = self.gamma(x_STMS, d_STMS) # instantan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inner(base_example: int = 0):\n EX = Xy_raw.iloc[base_example]\n print(\"Base Example IDs:\")\n print((Xy_raw.index[[base_example]]).to_frame().reset_index(drop=True).iloc[0].rename(index=base_example))\n\n def get_widget(col: str):\n V = EX[col]\n ...
[ "0.561758", "0.5532706", "0.5529303", "0.5527711", "0.5519285", "0.550442", "0.5463318", "0.54252416", "0.54042125", "0.53651315", "0.53214335", "0.53111446", "0.53067505", "0.5293779", "0.5253569", "0.5244779", "0.5231657", "0.52291465", "0.52013093", "0.519316", "0.5190529"...
0.4949127
50
Compute statistics for map class.
def stats(self, s_sample, d_sample, x_sample, wav_len): s_STMS_sample, d_STMS_sample, x_STMS_sample = self.transfrom_stats(s_sample, d_sample, x_sample, wav_len) self.mag_map.stats(s_STMS_sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_statistics(self):", "def _get_stats(self):\n self.stats = set()\n self._bstats = set()\n self._h_bstats = set()\n self._tstats = set()\n self._ftstats = set()\n for cl in self.data_classes:\n for stat in cl._bstats:\n self.stats.add(...
[ "0.65744215", "0.62907714", "0.6119016", "0.5945289", "0.59396243", "0.5904752", "0.5866978", "0.5799329", "0.5752798", "0.5724647", "0.5713357", "0.5663257", "0.5654346", "0.56468195", "0.5640491", "0.56287575", "0.5622677", "0.5621717", "0.56140465", "0.5601541", "0.5593295...
0.0
-1
Compute example for Deep Xi, i.e. observation (noisyspeech STMS) and target (mapped cleanspeech STMS).
def example(self, s, d, s_len, d_len, snr): s, d, x, n_frames = self.mix(s, d, s_len, d_len, snr) s_STMS, _ = self.polar_analysis(s) x_STMS, _ = self.polar_analysis(x) s_STMS_bar = self.mag_map.map(s_STMS) return x_STMS, s_STMS_bar, n_frames
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_examples():\n\n for example in examples:\n\n print(str(example) + \" : \", end=\" \")\n try:\n t, smush = analyse(example, my_env)\n print(lookup(t, smush))\n # print(\"Smush\")\n # for k,v in smush.items():\n # print(f\"\\t{k} : {...
[ "0.5824792", "0.5691818", "0.5683374", "0.5670519", "0.5620943", "0.5595104", "0.5562455", "0.5492571", "0.5483506", "0.546794", "0.53820264", "0.53769636", "0.5361784", "0.53402865", "0.5306678", "0.5282997", "0.52611387", "0.5255092", "0.525358", "0.52528375", "0.52450264",...
0.0
-1
Cleanspeech magnitude spectrum estimate.
def mag_hat(self, s_STMS_bar_hat): s_STMS_hat = self.mag_map.inverse(s_STMS_bar_hat) return s_STMS_hat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_fft_mag(self, ch_id: int, func_id: int) -> None:\n self.write(':function{0}:fftmagnitude channel{1}'.format(func_id, ch_id))", "def testCalspecMags(self):\n std = MKIDStd.MKIDStd()\n bFilter = std.filters['B']\n vFilter = std.filters['V']\n\n # BD17\n bd17Flux =...
[ "0.6712164", "0.65049195", "0.64892966", "0.6451894", "0.643721", "0.64305013", "0.63324183", "0.6301175", "0.62896734", "0.6238569", "0.62249374", "0.61692566", "0.61671096", "0.61482257", "0.61449903", "0.6119389", "0.6116", "0.6094681", "0.605757", "0.60449857", "0.6025843...
0.0
-1
Compute statistics for map class.
def stats(self, s_sample, d_sample, x_sample, wav_len): pass # s_STMS_sample, d_STMS_sample, x_STMS_sample = self.transfrom_stats(s_sample, # d_sample, x_sample, wav_len) # smm_sample = tf.math.truediv(s_STMS_sample, x_STMS_sample) # self.smm_map.stats(smm_sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_statistics(self):", "def _get_stats(self):\n self.stats = set()\n self._bstats = set()\n self._h_bstats = set()\n self._tstats = set()\n self._ftstats = set()\n for cl in self.data_classes:\n for stat in cl._bstats:\n self.stats.add(...
[ "0.65744215", "0.62907714", "0.6119016", "0.5945289", "0.59396243", "0.5904752", "0.5866978", "0.5799329", "0.5752798", "0.5724647", "0.5713357", "0.5663257", "0.5654346", "0.56468195", "0.5640491", "0.56287575", "0.5622677", "0.5621717", "0.56140465", "0.5601541", "0.5593295...
0.0
-1
Compute example for Deep Xi, i.e. observation (noisyspeech STMS) and target (mapped SMM).
def example(self, s, d, s_len, d_len, snr): s, d, x, n_frames = self.mix(s, d, s_len, d_len, snr) s_STMS, _ = self.polar_analysis(s) x_STMS, _ = self.polar_analysis(x) smm = tf.math.truediv(s_STMS, x_STMS) smm_bar = tf.clip_by_value(smm, 0.0, 5.0) return x_STMS, smm_bar, n_frames
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example(self, s, d, s_len, d_len, snr):\n\t\ts, d, x, n_frames = self.mix(s, d, s_len, d_len, snr)\n\t\ts_STDCT = self.stdct_analysis(s)\n\t\td_STDCT = self.stdct_analysis(d)\n\t\tx_STDCT = self.stdct_analysis(x)\n\t\txi = self.xi(s_STDCT, d_STDCT)\n\t\txi_bar = self.xi_map.map(xi)\n\t\tcd = self.cd(s_STDCT, d...
[ "0.5828444", "0.5814742", "0.57863617", "0.5774569", "0.5745876", "0.5639922", "0.56284", "0.5524214", "0.5508927", "0.54629517", "0.5452237", "0.5401009", "0.5391395", "0.5337255", "0.5312473", "0.5297813", "0.5287868", "0.52411807", "0.52124095", "0.52074903", "0.5198711", ...
0.51034695
32
An observation for Deep Xi (noisyspeech STMS and STPS).
def observation(self, x): x = self.normalise(x) x_STMS, x_STPS = self.polar_analysis(x) x_STMS_STPS = tf.concat([x_STMS, x_STPS], axis=-1) return x_STMS_STPS, x_STMS_STPS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observation(self, x):\n\t\tx = self.normalise(x)\n\t\tx_STDCT = self.stdct_analysis(x)\n\t\treturn x_STDCT, None", "def observation(self, x):\n\t\tx = self.normalise(x)\n\t\tx_STMS, x_STPS = self.polar_analysis(x)\n\t\treturn x_STMS, x_STPS", "def get_observable_description(stix_obj, log):\n desc = \"\"...
[ "0.551871", "0.5380339", "0.5367954", "0.52299434", "0.5219479", "0.50972205", "0.50261205", "0.4998411", "0.4998411", "0.49744838", "0.49730173", "0.49615476", "0.49530286", "0.49497813", "0.49444118", "0.49292263", "0.49218303", "0.49119952", "0.48962384", "0.48684102", "0....
0.5608419
0
Compute statistics for map class.
def stats(self, s_sample, d_sample, x_sample, wav_len): s_STMS_sample, d_STMS_sample, x_STMS_sample = self.transfrom_stats(s_sample, d_sample, x_sample, wav_len) xi_sample = self.xi(s_STMS_sample, d_STMS_sample) self.xi_map.stats(xi_sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_statistics(self):", "def _get_stats(self):\n self.stats = set()\n self._bstats = set()\n self._h_bstats = set()\n self._tstats = set()\n self._ftstats = set()\n for cl in self.data_classes:\n for stat in cl._bstats:\n self.stats.add(...
[ "0.65744215", "0.62907714", "0.6119016", "0.5945289", "0.59396243", "0.5904752", "0.5866978", "0.5799329", "0.5752798", "0.5724647", "0.5713357", "0.5663257", "0.5654346", "0.56468195", "0.5640491", "0.56287575", "0.5622677", "0.5621717", "0.56140465", "0.5601541", "0.5593295...
0.0
-1
Compute example for Deep Xi, i.e. observation (noisyspeech STMS) and target (mapped a priori SNR and cleanspeech STPS).
def example(self, s, d, s_len, d_len, snr): s, d, x, n_frames = self.mix(s, d, s_len, d_len, snr) s_STMS, s_STPS = self.polar_analysis(s) d_STMS, _ = self.polar_analysis(d) x_STMS, x_STPS = self.polar_analysis(x) x_STMS_STPS = tf.concat([x_STMS, x_STPS], axis=-1) s_stps_bar = self.s_stps_map.map(s_STPS) x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example(self, s, d, s_len, d_len, snr):\n\t\ts, d, x, n_frames = self.mix(s, d, s_len, d_len, snr)\n\t\ts_STDCT = self.stdct_analysis(s)\n\t\td_STDCT = self.stdct_analysis(d)\n\t\tx_STDCT = self.stdct_analysis(x)\n\t\txi = self.xi(s_STDCT, d_STDCT)\n\t\txi_bar = self.xi_map.map(xi)\n\t\tcd = self.cd(s_STDCT, d...
[ "0.5912997", "0.5688673", "0.56836474", "0.5642693", "0.56281203", "0.55855364", "0.55046743", "0.54866296", "0.543769", "0.5418274", "0.53932106", "0.5371007", "0.53687495", "0.5326887", "0.52985626", "0.52625364", "0.52527297", "0.52423537", "0.5238088", "0.5227399", "0.520...
0.5223498
20
A priori SNR estimate.
def xi_hat(self, xi_s_stps_bar_hat): xi_bar_hat, _ = tf.split(xi_s_stps_bar_hat, num_or_size_splits=2, axis=-1) xi_hat = self.xi_map.inverse(xi_bar_hat) return xi_hat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SNR(S, S0):\n return np.var(S) / np.var(S - S0)", "def calculateSNR(self):\n pass", "def observed_snr(psrsnr, psrra, psrdec):\n global beam_profile\n return lambda obsra,obsdec: psrsnr*beam_profile.gain_at_angular_offset(angsep_arcmin(psrra, psrdec, obsra, obsdec))", "def get_S_r(self):\n...
[ "0.73832285", "0.6766759", "0.650804", "0.64868206", "0.6477918", "0.6270175", "0.62219375", "0.60975206", "0.60889465", "0.5873745", "0.58645684", "0.5822557", "0.57586515", "0.57262117", "0.56956685", "0.56705034", "0.56653404", "0.56461066", "0.5641833", "0.56205493", "0.5...
0.0
-1
An observation for Deep Xi (noisyspeech __________).
def observation(self, x): x = self.normalise(x) x_STDCT = self.stdct_analysis(x) return x_STDCT, None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_observation(self, observation):", "def observe(self, observation):\n # shallow copy observation (deep copy can be expensive)\n obs = observation.copy()\n is_training = 'labels' in observation\n\n if not obs.get('preprocessed', False) or 'text2vec' not in obs:\n # p...
[ "0.5956446", "0.5778979", "0.56497204", "0.5631569", "0.5631569", "0.56061625", "0.54807776", "0.533764", "0.5285102", "0.52759814", "0.5189152", "0.5159776", "0.51573926", "0.51573926", "0.51565295", "0.51266104", "0.5122549", "0.5074193", "0.5045252", "0.5032521", "0.502552...
0.4674456
61
Compute statistics for map class.
def stats(self, s_sample, d_sample, x_sample, wav_len): s_STDCT_sample, d_STDCT_sample, x_STDCT_sample = self.transfrom_stats(s_sample, d_sample, x_sample, wav_len) xi_sample = self.xi(s_STDCT_sample, d_STDCT_sample) self.xi_map.stats(xi_sample) cd_sample = self.cd(s_STDCT_sample, d_STDCT_sample) self.cd_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_statistics(self):", "def _get_stats(self):\n self.stats = set()\n self._bstats = set()\n self._h_bstats = set()\n self._tstats = set()\n self._ftstats = set()\n for cl in self.data_classes:\n for stat in cl._bstats:\n self.stats.add(...
[ "0.65744215", "0.62907714", "0.6119016", "0.5945289", "0.59396243", "0.5904752", "0.5866978", "0.5799329", "0.5752798", "0.5724647", "0.5713357", "0.5663257", "0.5654346", "0.56468195", "0.5640491", "0.56287575", "0.5622677", "0.5621717", "0.56140465", "0.5601541", "0.5593295...
0.0
-1
Transforms timedomain sample to shorttime discrete cosine transform sample.
def transfrom_stats(self, s_sample, d_sample, x_sample, wav_len): s_STDCT_sample = [] d_STDCT_sample = [] x_STDCT_sample = [] for i in tqdm(range(s_sample.shape[0])): s_STDCT = self.stdct_analysis(s_sample[i,0:wav_len[i]]) d_STDCT = self.stdct_analysis(d_sample[i,0:wav_len[i]]) x_STDCT = self.stdct_ana...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discrete_cosine_tranform(self, matrix):\n\n\n x = matrix.shape[0]\n y = matrix.shape[1]\n N = x\n\n #Fourier Transform matrix:\n dct = np.zeros([x,y])\n\n for u in range(0, x):\n for v in range(0, y):\n sum_ft = 0\n for i in ran...
[ "0.6027315", "0.5937768", "0.58317256", "0.5667302", "0.56169987", "0.55450565", "0.55325866", "0.5453489", "0.544513", "0.5440955", "0.53548825", "0.5332746", "0.5305275", "0.52922577", "0.5248724", "0.5182515", "0.5168746", "0.51626503", "0.51584834", "0.5127825", "0.511244...
0.0
-1
Compute example for Deep Xi, i.e. observation (noisyspeech STDCT) and target (________).
def example(self, s, d, s_len, d_len, snr): s, d, x, n_frames = self.mix(s, d, s_len, d_len, snr) s_STDCT = self.stdct_analysis(s) d_STDCT = self.stdct_analysis(d) x_STDCT = self.stdct_analysis(x) xi = self.xi(s_STDCT, d_STDCT) xi_bar = self.xi_map.map(xi) cd = self.cd(s_STDCT, d_STDCT) cd_bar = self.cd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inner(base_example: int = 0):\n EX = Xy_raw.iloc[base_example]\n print(\"Base Example IDs:\")\n print((Xy_raw.index[[base_example]]).to_frame().reset_index(drop=True).iloc[0].rename(index=base_example))\n\n def get_widget(col: str):\n V = EX[col]\n ...
[ "0.5948067", "0.5827459", "0.57894105", "0.5788213", "0.5717672", "0.56456167", "0.56404275", "0.56256986", "0.56024945", "0.56013584", "0.55033076", "0.54619145", "0.54451805", "0.5437617", "0.5351964", "0.53468955", "0.5345055", "0.53102803", "0.5282422", "0.52763444", "0.5...
0.5453168
12
A priori SNR estimate.
def xi_hat(self, xi_cd_bar_hat): xi_bar_hat, _ = tf.split(xi_cd_bar_hat, num_or_size_splits=2, axis=-1) xi_hat = self.xi_map.inverse(xi_bar_hat) return xi_hat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SNR(S, S0):\n return np.var(S) / np.var(S - S0)", "def calculateSNR(self):\n pass", "def observed_snr(psrsnr, psrra, psrdec):\n global beam_profile\n return lambda obsra,obsdec: psrsnr*beam_profile.gain_at_angular_offset(angsep_arcmin(psrra, psrdec, obsra, obsdec))", "def get_S_r(self):\n...
[ "0.7378384", "0.6761361", "0.6504994", "0.64850724", "0.6474928", "0.6267786", "0.6218195", "0.6095376", "0.6088404", "0.5869324", "0.58604723", "0.58211243", "0.5758803", "0.5722649", "0.5691067", "0.56659824", "0.56636083", "0.5644464", "0.56381714", "0.56173897", "0.561616...
0.0
-1
Trigger Test Execution and dump logs at appropriate location
def start_test_exec(cls): time_str = cls.get_current_time() os.system("robot -l ./logs/log_{0}.html -r ./logs/report_{0}.html -o ./logs/output_{0}.xml \ ./test_suite/{1}".format(time_str, test_suite))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_test_begin(self, logs=None):", "def execute(self):\n for test in self.tests:\n test.execute()\n self.logger.dump()\n print(\"Finished!\")", "def on_test_end(self, logs=None):", "def main(): \n suite = unittest.TestLoader().discover(unitTestDirectory) \n os.chdir...
[ "0.72355634", "0.7038262", "0.6995081", "0.6811806", "0.6726337", "0.6570318", "0.64170235", "0.64038604", "0.63951", "0.6389814", "0.63837314", "0.63769907", "0.6355394", "0.63484395", "0.6343703", "0.629082", "0.6271052", "0.62661713", "0.62363887", "0.622673", "0.6221592",...
0.6903039
3
Change the setting according to different languages
def config(language): global k # Set The window size global ignore_U_activated # Set True to ignore the training data with Unknown senseid global vector_0_1 # Set True to convert vectors to "binary form" e.g.: [0,3,0,4]->[0,1,0,1] global remove_punctuations_activated # Set True to ignore all the pun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_language(self, lang):\n self.lang = lang", "def do_lang(self, lang):\n\n self.lang = lang\n print(\"Set language to %s\" % lang)", "def use_en(self):\n pass", "def _change_lang(self):\n lang = self.ddnGuiLanguage.get()\n self.lblProject['text'] = LOCALIZED_TE...
[ "0.69599074", "0.69340986", "0.68247986", "0.6628936", "0.6613911", "0.6550377", "0.6531084", "0.65080315", "0.64949137", "0.64905906", "0.6372799", "0.6351079", "0.6329504", "0.6323646", "0.63018024", "0.6256488", "0.6245913", "0.62027204", "0.6172503", "0.6155253", "0.61533...
0.0
-1
replace the accented char to unicode
def replace_accented(input_str): nkfd_form = unicodedata.normalize('NFKD', input_str) return u"".join([c for c in nkfd_form if not unicodedata.combining(c)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_accented(text: str) -> str:\n return unidecode.unidecode(text)", "def removeAccent(v):\n\tif v == u'á':\n\t\treturn u'a'\n\telif v == u'é':\n\t\treturn u'é'\n\telif v == u'í':\n\t\treturn u'í'\n\telif v == u'ó':\n\t\treturn u'ó'\n\telif v == u'ú':\n\t\treturn u'ú'\n\telse:\n\t\treturn v", "def ...
[ "0.7634012", "0.7428132", "0.730271", "0.6957801", "0.6929055", "0.69152033", "0.6757189", "0.6592186", "0.658624", "0.65804595", "0.65484446", "0.6519656", "0.64930964", "0.6430187", "0.64014155", "0.6372255", "0.6342636", "0.6339085", "0.63120615", "0.6309369", "0.6292421",...
0.7028545
3
Method to remove the punctuations. used in get_left_right_lists()
def remove_punctuations(tokens): if not remove_punctuations_activated: return tokens output = [] for token in tokens: if token not in string.punctuation: output.append(token) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_punct(self,text):", "def remove_punctuation(self):\n new_words = []\n # new_words = \"\"\n for word in self.words:\n new_word = re.sub(r'[^\\w\\s]', '', word)\n if new_word != '':\n new_words.append(new_word)\n # new_words += f\"...
[ "0.7727744", "0.7568999", "0.7444831", "0.7415628", "0.7375689", "0.7340214", "0.7339326", "0.73319995", "0.71979105", "0.71084756", "0.71058077", "0.7086695", "0.70844007", "0.7029791", "0.70217824", "0.69636303", "0.6910627", "0.6901472", "0.68913054", "0.6882913", "0.68826...
0.7303184
8
Method to remove the stop words used in get_left_right_lists() This method does not work for Catalan language.
def remove_stop_words(tokens, language): if not remove_stop_words_activated or language.__eq__("Catalan"): return tokens output = [] stop = stopwords.words(language.lower()) for token in tokens: if token not in stop: output.append(token) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)", "def remove_stop_words(self):\n self.word_list = [word for word...
[ "0.8411666", "0.79770213", "0.7972711", "0.7953195", "0.7869722", "0.78230315", "0.7814691", "0.7796424", "0.773496", "0.77157074", "0.7703494", "0.7695574", "0.76948166", "0.76899654", "0.76872563", "0.76872563", "0.76872563", "0.76872563", "0.7681711", "0.76450783", "0.7597...
0.7611969
20
Method to perform stemming used in ge_left_right_lists() This method does not work for Catalan language
def stemming(tokens, language): if not stemming_activated or language.__eq__("Catalan"): return tokens output = [] stemmer = SnowballStemmer(language.lower()) for token in tokens: output.append(stemmer.stem(token)) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stemming(self,sentence):", "def do(text):\n return freeling_stemming(text)", "def stem(s):\n special = {'appall', 'kill', 'stroll', 'kiss', 'thrill', 'chugg', 'dress', 'err', 'express', 'fall', 'free', 'gall', 'add','cross', 'impress', 'inn', 'call', 'ball', 'bill', 'buzz'} \n ie_words = {'vyin...
[ "0.75466335", "0.70338714", "0.688869", "0.6862174", "0.681996", "0.6696101", "0.6692604", "0.6598883", "0.65930766", "0.6570551", "0.65544206", "0.65350866", "0.65114987", "0.6464337", "0.63825566", "0.6353275", "0.63480026", "0.63435036", "0.6331262", "0.6287844", "0.628566...
0.66490656
7
Method to convert words to lowercase used in ge_left_right_lists()
def lowercase(tokens): if not lowercase_activated: return tokens output = [token.lower() for token in tokens] return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_lowercase(words):\n new_words = []\n for word in words:\n new_word = word.lower()\n new_words.append(new_word)\n return new_words", "def toLowercase(self, words):\n\t\tnewWords = [word.lower() for word in words]\n\t\treturn newWords", "def to_lower(self, word_list):\n retu...
[ "0.79666525", "0.7932478", "0.777571", "0.7759111", "0.7755746", "0.772872", "0.772872", "0.772872", "0.772872", "0.772872", "0.772872", "0.772872", "0.76889205", "0.759694", "0.7588431", "0.724481", "0.7243115", "0.70872545", "0.70810866", "0.70804024", "0.7060341", "0.702...
0.730405
15
Method to expand the neighbor_word_list with synsets, hyponyms and hypernyms. used in get_neighbor_words_set()
def expand_synset(neighbor_word_list, language): if not expand_synset_activated or not language.__eq__("English"): return neighbor_word_list new_neighbor_word_set = set() for word in neighbor_word_list: new_neighbor_word_set.add(word) synsets = wn.synsets(word) synonyms_lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neighbor_words_list(sentence, language):\n if language.__eq__(\"Spanish\") or language.__eq__(\"Catalan\"):\n sentence = sentence.getElementsByTagName('target')[0]\n\n left_list, right_list = get_left_right_lists(sentence, language)\n neighbor_word_list = []\n\n for item in left_list[-k:...
[ "0.6233785", "0.54712224", "0.5385365", "0.53399545", "0.5255301", "0.5233051", "0.5192063", "0.51569444", "0.5123623", "0.50904995", "0.5077879", "0.50651765", "0.50616145", "0.5047993", "0.5031947", "0.5022816", "0.4951013", "0.4943876", "0.49117774", "0.49117774", "0.48616...
0.806715
0
Method to get the tokens on the left and right of the target word. The result list of tokens will be filtered according to different settings.
def get_left_right_lists(sentence, language): left_list = nltk.word_tokenize(replace_accented(sentence.childNodes[0].nodeValue.replace('\n', ''))) right_list = nltk.word_tokenize(replace_accented(sentence.childNodes[2].nodeValue.replace('\n', ''))) left_list = remove_stop_words(left_list, language) rig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tokens(self):\n\t\treturn self.get_starttokens() + self.get_endtokens()", "def tokens(self):\n\t\tlabels_and_synonyms = list(itertools.chain.from_iterable(list(self.term_to_tokens.values())))\n\t\ttokens = set(list(itertools.chain.from_iterable([word_tokenize(x) for x in labels_and_synonyms])))\n\t\tretu...
[ "0.6641464", "0.65268147", "0.64090097", "0.62245643", "0.62148035", "0.6099981", "0.6064908", "0.60643786", "0.6055512", "0.60490125", "0.60379094", "0.6024344", "0.6016069", "0.59767205", "0.5975851", "0.59644526", "0.58826864", "0.58402985", "0.5834286", "0.581225", "0.580...
0.58912784
16
Method to get a list of words that are within k distance of the target word in the sentece. The result might add the synsets, hyponyms, hypernyms according to the setting.
def get_neighbor_words_list(sentence, language): if language.__eq__("Spanish") or language.__eq__("Catalan"): sentence = sentence.getElementsByTagName('target')[0] left_list, right_list = get_left_right_lists(sentence, language) neighbor_word_list = [] for item in left_list[-k:]: neigh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_closest(target_word: str, word_to_idx: Dict, embeddings: torch.Tensor, n: int = 5) -> List[Tuple[str, torch.Tensor]]:\n\n # Calculate distances to all other words\n\n word_embedding = embeddings[word_to_idx[target_word.lower()]]\n distances = []\n for word, index in word_to_idx.items():\n ...
[ "0.66739005", "0.6587198", "0.6474009", "0.63638276", "0.62140906", "0.59948486", "0.5934092", "0.5922862", "0.58830327", "0.5794155", "0.5770745", "0.5758911", "0.57467514", "0.5735627", "0.57349575", "0.5718581", "0.5696987", "0.5696338", "0.5691832", "0.56733865", "0.56412...
0.6351839
4
Map the target word instance into the vector space
def extract_vector(inst, neighbor_word_list, _4c_4d_feature, language): if language.__eq__("English"): sentence = inst.getElementsByTagName('context')[0] else: sentence = inst.getElementsByTagName('context')[0].getElementsByTagName('target')[0] x = [] neighbors = {} left_list, right...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word2vec_mapping_func():\n return {\"belonging to\": \"belonging\", \"parked on\": \"parked\", \"growing on\": \"growing\", \"standing on\": \"standing\",\n \"made of\": \"made\", \"attached to\": \"attached\", \"hanging from\": \"hanging\", \"in front of\": \"front\",\n \"lying on\": ...
[ "0.6583183", "0.6582477", "0.63796186", "0.6378741", "0.63744193", "0.6344551", "0.62345594", "0.6214528", "0.6144772", "0.60987633", "0.60512793", "0.600911", "0.5989764", "0.59577274", "0.59557563", "0.5949267", "0.5930038", "0.5929878", "0.5927253", "0.5925144", "0.5886749...
0.5646689
42
Method to extract the features defined in 4c and 4d of the requirement
def extract_4c_4d_feature(neighbor_word_list, senseid_list, inst_list, language): if not extract_4c_feature_activated and not extract_chi_square_activated and not extract_pmi_activated: return [] output = [] # count_map usage: count_map[neighbor_index][sense_index] # each cell represent how ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_features(self):\n self.extract_features_static()\n self.extract_features_dynamic()", "def extract_features(self, inputs):\n pass", "def find_features(pyr):\n\n feature_lst = spread_out_corners(pyr[0], 3, 3, 3)\n descriptors = sample_descriptor(pyr[2],feature_lst/4,3)\n ...
[ "0.666153", "0.65839595", "0.6532236", "0.64225817", "0.64024997", "0.63473165", "0.63437116", "0.6284789", "0.62694913", "0.6235019", "0.61966836", "0.6129801", "0.60978454", "0.60606545", "0.6060298", "0.60424834", "0.6025452", "0.6024328", "0.5987201", "0.5986229", "0.5950...
0.58417434
29
Method to read the training set, parse the data, and train the classifier models.
def parse_train_data(training_set, language): print "Reading training set: " + training_set xmldoc = minidom.parse(training_set) lex_list = xmldoc.getElementsByTagName('lexelt') training_output = {} print "Processing training set and training models..." for node in lex_list: lexelt = no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n # 1. Extracting details of attributes\n\n self.get_attribute_data()\n if self.train_data is None and self.train_data_file is None:\n raise ValueError(\"Neither training data not training file provided\")\n\n self.get_train_data()\n self.classifie...
[ "0.77862453", "0.7440359", "0.7225737", "0.71957695", "0.71397114", "0.7089807", "0.70832306", "0.7017925", "0.70015496", "0.6981088", "0.6969763", "0.6942313", "0.6940365", "0.6899603", "0.6886717", "0.6883019", "0.6876929", "0.6874251", "0.6859709", "0.6850023", "0.6836232"...
0.7331279
2
Method to read the test set, parse the test data, and map each instance into a vector space
def parse_test_data(test_set, training_output, language): print "Reading test set: " + test_set xmldoc = minidom.parse(test_set) data = {} lex_list = xmldoc.getElementsByTagName('lexelt') for node in lex_list: lexelt = node.getAttribute('item') # item "active.v" data[lexelt] = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self, test_data):\n with open(test_data, 'r') as test_data:\n results = {}\n for type in self.label_type_map:\n results[self.label_type_map[type]] = []\n while True:\n tokens = test_data.readline().split()\n pos = test_da...
[ "0.66019076", "0.62800115", "0.6211686", "0.6174027", "0.60878825", "0.60251486", "0.60153896", "0.599982", "0.59790295", "0.5974165", "0.5945519", "0.59419864", "0.59393996", "0.5916594", "0.59055924", "0.58963406", "0.587455", "0.5853635", "0.5831062", "0.5817713", "0.58151...
0.66560996
0
This runs a command on the remote host. This returns a pexpect.spawn object. This handles the case when you try to connect to a new host and ssh asks you if you want to accept the public key fingerprint and continue connecting.
def ssh_command (user, host, password, command): ssh_newkey = 'Are you sure you want to continue connecting (yes/no)?' child = pexpect.spawn('ssh -l %s %s %s'%(user, host, command)) i = child.expect([ssh_newkey, PASSWORD, pexpect.TIMEOUT]) if i == 0: # First Time access - send yes to connect. chi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_remote(ipaddr, command):\n\n\treturn execute(['ssh', '-f', '-t', '-oPasswordAuthentication=no',\n\t\t'-l', 'alt', ipaddr, command])", "def ssh(pi):\n command = \"ssh {0}\".format(pi)\n subprocess.Popen(command, shell=True)", "def _remote_cmd(self, cmd, block=True):\n s = remote_cmd(hos...
[ "0.69595283", "0.6643719", "0.6521727", "0.6504823", "0.6419268", "0.6395431", "0.6382922", "0.6355576", "0.63307595", "0.63192797", "0.63166046", "0.62774366", "0.6273903", "0.62710875", "0.6231371", "0.6216641", "0.62067455", "0.6205677", "0.6203712", "0.61976033", "0.61973...
0.74644256
0
The constructor for reviewsMenuClass. Attributes
def __init__(self): super().__init__() self.status = True self.token = tokensClass() self.layout = layout.reviewsLayoutClass(self) self.title = "LMS Reviews GUI" self.location = (50, 125)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, menu_name):\n self.menu_name = menu_name", "def __init__(self, parent_menu, label):\n self._parent_menu = parent_menu\n self._options = {}\n self._label = label\n self._menu = Menu(parent_menu)\n self._key_underline = 0", "def __init__(self, name, ti...
[ "0.7024792", "0.6597017", "0.6345977", "0.6256314", "0.62525284", "0.62365556", "0.614118", "0.60794574", "0.60352033", "0.59544903", "0.59349453", "0.59194565", "0.5849597", "0.5827087", "0.58053714", "0.57678133", "0.57440007", "0.57258856", "0.5698869", "0.56835824", "0.56...
0.68060464
1
Check if the windows data has changed.
def checkChanges(self): results = [ self.values[1], self.values[f"-{self.values[1]}-"], self.values["-TOGGLE-ALL-"], self.values["-INVITED-"], self.values["-ASSIGNED-"], self.values["-GRADED-"], self.values["-BLOCKED-"] ] if results == self.oldRes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isDataChanged(self):\n return bool(self._dirty or self.ui.channelEditor.getQModel().isDataChanged() or self._dirtyMntGrps)", "def has_changed(self):\n return bool(self.changed_data)", "def has_changed(self):\n return self.get_old_value() != self.get_current_value()", "def is_map_upda...
[ "0.7027425", "0.6961861", "0.66968995", "0.6653497", "0.64225286", "0.6422174", "0.62375546", "0.62212265", "0.61942613", "0.6186411", "0.6186323", "0.6186147", "0.6186073", "0.6154169", "0.61373127", "0.61164427", "0.6112394", "0.610498", "0.6104862", "0.6104862", "0.6092413...
0.6343356
6
Return a Document object representing the content of the document from the given input.
def load_asterix_category_format(k): global filenames try: __basePath__ = os.path.abspath(os.path.join(os.getcwd(), '../../../..')) # Look for file in current executing directory path_filename1 = filenames[k] # On default directory (absolute) path_filename2 = __basePath...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_document(file_name):\n path = INPUT_DIR+file_name # assemble the file descriptor\n file = open(path) # open in read mode\n doc = Document() # create a new document\n # add the title field\n doc.add(StringField(\"title\", input_file, Field.Store.YES))\n # add the whole book\n doc....
[ "0.64854324", "0.6355642", "0.6201583", "0.60756934", "0.59871686", "0.59677255", "0.5932967", "0.5922465", "0.5922113", "0.5915639", "0.5866021", "0.5860824", "0.5852239", "0.5846324", "0.58160543", "0.58058417", "0.58058417", "0.58058417", "0.58058417", "0.58058417", "0.580...
0.0
-1
Encodes a dictionary (asterix) in the EUROCONTROL ASTERIX category.
def encode(asterix): assert type(asterix) is dict asterix_record = 0 #priority_asterix_cat = [21, 34] for k, v in asterix.iteritems(): #for k in priority_asterix_cat: v = asterix[k] record = 0 n_octets_data_record = 0 cat = 0 ctf = load_asterix_category_for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(category_main : ):", "def latin1_to_ascii(self, unicrap):\n xlate = {0xc0: 'A', 0xc1: 'A', 0xc2: 'A', 0xc3: 'A', 0xc4: 'A', 0xc5: 'A',\n 0xc6: 'Ae', 0xc7: 'C',\n 0xc8: 'E', 0xc9: 'E', 0xca: 'E', 0xcb: 'E',\n 0xcc: 'I', 0xcd: 'I', 0xce: 'I', 0xcf: ...
[ "0.5903913", "0.49887666", "0.49819857", "0.49383077", "0.49203125", "0.4909551", "0.4891353", "0.47965437", "0.47933576", "0.4793037", "0.47612906", "0.47022176", "0.4689794", "0.46841627", "0.46771052", "0.46750674", "0.4664644", "0.4662446", "0.4597144", "0.4587141", "0.45...
0.6899768
0
Encodes the record from the given category (cat).
def encode_category(cat, did, tree): if did == {}: return 0, 0 mdi = {} for c in tree.getElementsByTagName('DataItem'): di = c.getAttribute('id') if di.isdigit(): di = int(di) rule = c.getAttribute('rule') if di in did: if verbose >= 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(category_main : ):", "def add_category(self, category: str) -> None:\n for letter in self.data:\n if not self.data[letter].get(category):\n self.data[letter][category] = []\n print(f'Categoria: {category} adicionada ao dicionário.')\n self.save()\n self.beautify_json()", "def...
[ "0.67229545", "0.561765", "0.5484989", "0.5475443", "0.5324302", "0.5320905", "0.53020734", "0.524053", "0.51852304", "0.50320554", "0.50262564", "0.5022167", "0.49936855", "0.49604708", "0.4958038", "0.4957628", "0.49234056", "0.49139455", "0.48985356", "0.48847762", "0.4876...
0.6056459
1
Returns the encoded Data Item. Encodes the Data Item in the data field of record according to the rules defined in the XML file.
def encode_dataitem(dfd, tree): assert type(dfd) is dict or type(dfd) is list for c in tree.getElementsByTagName('DataItemFormat'): for d in c.childNodes: if d.nodeName == 'Fixed': return encode_fixed(dfd, d) else: if d.nodeName == 'Variable': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prep_posting_data(cls, items: List[dict]) -> bytes:\n\n def my_item_func(x):\n if x == \"contributors\":\n return \"contributor\"\n elif x == \"records\":\n return \"record\"\n\n xml = dicttoxml(\n items, custom_root=\"records\", attr...
[ "0.5869862", "0.5869558", "0.5837552", "0.5814655", "0.56730103", "0.5657856", "0.56101656", "0.5610163", "0.55314076", "0.544302", "0.5434582", "0.54142344", "0.54142344", "0.53586537", "0.53413665", "0.53378576", "0.5311251", "0.53084904", "0.529813", "0.52737993", "0.52665...
0.5936579
0
Returns the encoded Data Item as a fixed length Data Field.
def encode_fixed(bd, tree): length = int(tree.getAttribute('length')) value = 0 has_encoded = False for cn in tree.childNodes: if cn.nodeName != 'Bits': continue key = cn.getElementsByTagName('BitsShortName')[0].firstChild.nodeValue bits_unit = cn.getElementsByTagNam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataField(self):\n if not self.checkPacketLength():\n raise AttributeError(\"inconsistent packetLength\")\n dataFieldLength = self.packetLength + 1\n return self.getBytes(PRIMARY_HEADER_BYTE_SIZE, dataFieldLength)", "def _make_data(self, approximate_length):\n fragments = []\n ...
[ "0.63875425", "0.59056175", "0.5892664", "0.5751579", "0.5726015", "0.5717459", "0.56408036", "0.5604431", "0.55373055", "0.5520101", "0.5478277", "0.54433966", "0.5440741", "0.5440741", "0.5440741", "0.54311866", "0.54259306", "0.5384928", "0.5370295", "0.53652525", "0.53558...
0.0
-1
Returns the encoded Data Item as a variable length Data Field.
def encode_variable(db, tree): variable = None length = 0 for cn in tree.childNodes: if cn.nodeName == 'Fixed': l, v = encode_fixed(db, cn) assert l <= 1 if l > 0: if v % 2 == 1: # remove FX v -= 1 length += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataField(self):\n if not self.checkPacketLength():\n raise AttributeError(\"inconsistent packetLength\")\n dataFieldLength = self.packetLength + 1\n return self.getBytes(PRIMARY_HEADER_BYTE_SIZE, dataFieldLength)", "def _make_data(self, approximate_length):\n fragments = []\n ...
[ "0.61314625", "0.5894277", "0.58546203", "0.5693786", "0.5666211", "0.5647324", "0.5623186", "0.56118745", "0.55618566", "0.55471104", "0.5499954", "0.5487959", "0.54705465", "0.5446327", "0.5446327", "0.5446327", "0.543052", "0.53857625", "0.53433186", "0.5292977", "0.528206...
0.49473855
73
Returns the encoded Data Item as a repetitive Data Field.
def encode_repetitive(db, tree): found = False cn = None for cn in tree.childNodes: if cn.nodeName == 'Fixed': found = True break # found if found is False: if verbose >= 1: print 'Repetitive node not found' return 0, 0 assert type(db) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_data(self, _item_fields, special=None):\n\n if special:\n _item_fields[\"special\"] = special\n\n return _item_fields", "def parseDataField(self):\r\n devId = str(self.deviceId)\r\n datamap = self._datamaps[devId]\r\n work = ''\r\n dataIndex = 0\r\n...
[ "0.6104918", "0.58814096", "0.5728895", "0.57196414", "0.57100666", "0.56371856", "0.5614055", "0.55791503", "0.547264", "0.5462666", "0.54213923", "0.5414014", "0.5412282", "0.5395359", "0.5324551", "0.52903366", "0.52721554", "0.5272136", "0.52712506", "0.5270539", "0.52601...
0.0
-1
Returns the encoded Data Item as a compound Data Field.
def encode_compound(db, tree): length = 0 data = 0 sf = 0 subfields = [] for cn in tree.childNodes: l = 0 if cn.nodeName == 'Variable': l, v = encode_variable(db, cn) else: if cn.nodeName == 'Fixed': l, v = encode_fixed(db, cn) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPyData(self, item):\r\n\r\n return item.GetData()", "def packed_data_from_item(self, item):\n\n # Pack the header parts into a struct with the order:\n # (inUse, previousBlock, length, nextBlock)\n header_struct = struct.Struct(self.HEADER_STRUCT_FORMAT_STR)\n packed_dat...
[ "0.6337071", "0.6224041", "0.6077705", "0.59297544", "0.5877927", "0.57838255", "0.57687294", "0.5726019", "0.5706959", "0.5676793", "0.5676793", "0.5676793", "0.56754076", "0.56752783", "0.56488013", "0.5550367", "0.5550367", "0.5540494", "0.5540494", "0.55401415", "0.551202...
0.5412696
29
Board Path Cloner This function is used to clone the BoardPath object.
def clone(self): # Run the constructor. other = BoardPath() # Copy the object variables other._current_cost = self._current_cost other._path = self._path[:] other._current_loc = self._current_loc return other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self):\n joined_function = lambda: dot_joiner(self.path, self.path_type)\n return self.__class__(self.path, self.configuration, self.converters, self.ignore_converters, joined_function=joined_function)", "def clone(self) -> 'BoardGraph':\n return self.__class__(self.board_class)", ...
[ "0.69156903", "0.6680933", "0.6565345", "0.64692", "0.63603795", "0.63189757", "0.6306653", "0.62988687", "0.6227066", "0.6202716", "0.6115038", "0.6103501", "0.6099532", "0.60984504", "0.6085155", "0.6061067", "0.60572535", "0.6047523", "0.5992621", "0.59245497", "0.59100866...
0.81588864
0
Current Location Accessor Function to get the current location for this path.
def get_current_location(self): return self._current_loc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_location(self):\n return self.enu_2_local()", "def get_current_location():\n global current_location\n return current_location", "def get_location(self):\r\n return self.__location", "def get_location(self):\n\t\treturn self.location", "def get_location(self):\n r...
[ "0.82560873", "0.8195256", "0.8011756", "0.79347134", "0.7920117", "0.78825885", "0.7742611", "0.7653603", "0.7653603", "0.7628534", "0.7536863", "0.75195265", "0.75195265", "0.75195265", "0.75195265", "0.75195265", "0.75195265", "0.75195265", "0.75195265", "0.75195265", "0.7...
0.8912243
0
Distance Calculator Flexible function for calculating the distance. Depending on the specified heuristic (either explicit in call or implicit with class), different distances can be returned for the same functions.
def get_distance(self, heuristic=""): # If no heuristic is specified, used the default if(heuristic == ""): heuristic = BoardPath._heuristic if(heuristic == "manhattan"): return self.calculate_manhattan_dist() elif(heuristic == "euclidean"): return se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heuristic(current, goal):\r\n distance = getDistance(current, goal)\r\n return distance", "def test_distance(self):\n\n def f(a, b):\n if a == b:\n return 0\n if (a in \"UC\" and b in \"UC\") or (a in \"AG\" and b in \"AG\"):\n return 1\n ...
[ "0.639866", "0.6343634", "0.61924297", "0.59297323", "0.59297323", "0.5853613", "0.5760782", "0.57106924", "0.56957674", "0.56786555", "0.56701374", "0.565588", "0.5652829", "0.56316733", "0.56216407", "0.5561049", "0.5556251", "0.55511826", "0.5511873", "0.550787", "0.549677...
0.7659271
0
Manhattan Distance Calculator Calculates difference between current location and\ the goal location using Manhattan distance.
def calculate_manhattan_dist(self): return self._current_cost + abs(self._current_loc.get_row() - self._goal_loc.get_row()) +\ abs(self._current_loc.get_column() - self._goal_loc.get_column())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __manhattan(self, x_state, y_state, x_goal, y_goal):\n distance = (abs(x_state - x_goal) + abs(y_state - y_goal))\n return distance", "def manhattan_distance(self):\n return calculate_manhattan_distance(self.location, self.target_location)", "def manhattan_distance(self):\n x, y...
[ "0.8165803", "0.8088598", "0.7407255", "0.73463696", "0.73238844", "0.7292226", "0.7271559", "0.7247168", "0.7209934", "0.71817213", "0.7162157", "0.71465975", "0.7138987", "0.71370137", "0.70733595", "0.7065889", "0.70469683", "0.70367557", "0.69594985", "0.69328445", "0.689...
0.816172
1
Euclidean Distance Calculator Calculates difference between current location and\ the goal location using Euclidean distance.
def calculate_euclidean_dist(self): x_dist = self._current_loc.get_column() - self._goal_loc.get_column() y_dist = self._current_loc.get_row() - self._goal_loc.get_row() # Note ** is power operator in Python return self._current_cost + sqrt(x_dist**2 + y_dist**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distance(self):\n return sqrt(pow((self.goal_pose.x - self.ground_truth_pose.x), 2) +\n pow((self.goal_pose.y - self.ground_truth_pose.y), 2))", "def getEuclideanDistance():\r\n global euclideanDistance\r\n return euclideanDistance", "def euclideanDistance(loc1, lo...
[ "0.7016859", "0.696656", "0.6942588", "0.6918102", "0.6652748", "0.66375005", "0.65335757", "0.64920557", "0.6466708", "0.6416474", "0.63655174", "0.63655174", "0.63360476", "0.6332252", "0.6328849", "0.632643", "0.63199997", "0.63198346", "0.63112885", "0.62728566", "0.62400...
0.78475267
0
Custom Zayd Special Distance Calculator Calculates difference between current location and\ the goal location using Zayd's distance heuristic.
def calculate_made_up_dist(self): # Ensure if current state equals goal, cost is only the current cost if self._goal_loc == self._current_loc: return self._current_cost # Distance is at least the Manhattan distance as cannot move diagonal estimated_distance = self.calculate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heuristic(current, goal):\r\n distance = getDistance(current, goal)\r\n return distance", "def heuristic(current, goal):\r\n # First tried manhattan distance but wasn't good enough so did direct distance which makes sense since the robot came move diagonally \r\n #return abs(current[0]-goal[0])...
[ "0.65399253", "0.64060277", "0.6318687", "0.618697", "0.6142503", "0.6033802", "0.6030698", "0.59373665", "0.589785", "0.58269316", "0.5824655", "0.57994634", "0.5755225", "0.5716154", "0.5683554", "0.56740296", "0.56517506", "0.5640818", "0.5628238", "0.5612277", "0.56118983...
0.54997057
35
Direct Blocked Path Checker This function checks whether if all direct next moves from the current location are blocked by an unpassable object or the edge of the board. This can be used to determine a penalty factor when calculating the heuristic. This function is used in the made_up heuristics function.
def _is_all_direct_next_moves_blocked(self, reference_board=None): # Use untraversed board if none is specified if reference_board is None: reference_board = BoardPath._untraversed_board # Case #1 - Goal and Current Location in the Same Row if self._current_loc.get_row() == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move_knight_legally_blocked(self):\n for piece in [('N', True), ('N', False)]:\n self.c.board = \\\n [[('K', piece[1]) for i in range(8)] for i in range(8)]\n self.c.turn = piece[1]\n self.c.board[4][4] = piece\n for dest in ['d6', 'f6', 'c...
[ "0.61759573", "0.61158156", "0.5978466", "0.5958256", "0.59319913", "0.5661901", "0.56494457", "0.56460166", "0.5641585", "0.5622185", "0.5597397", "0.5537868", "0.54507625", "0.5450352", "0.5431192", "0.54221904", "0.5419678", "0.5415468", "0.5415228", "0.541518", "0.5394872...
0.7079593
0
Mover Checker Verifies whether a move is valid for a given path.
def is_move_valid(self, direction, reference_board=None): # Verify a left move does not take you off the board. if (direction == "l"): if (self._current_loc.get_column() == 0): return False # Verify an up move does not take you off the board. elif (direction =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_move(self, move):\n\n if str(move) in self.moves_made:\n return False\n return True", "def validate_move(self, move_from, move_to, board):\n\n pass", "def move_valid(move):\n return True", "def validate_move(move):\n if move[0] in cc.VALID_RANKS and move[1] in ...
[ "0.71684873", "0.7160028", "0.7147075", "0.7132495", "0.70763445", "0.7041763", "0.68818665", "0.6880778", "0.685912", "0.68394464", "0.67674154", "0.6734097", "0.6732282", "0.67246544", "0.6705072", "0.6702802", "0.6683885", "0.6683341", "0.66618806", "0.66553384", "0.660803...
0.71321493
4
Move Location Calculator Calculates the new location for a move in the specified direction.
def _calculate_move_location(self, direction): current_row = self._current_loc.get_row() current_column = self._current_loc.get_column() # Calculate the new location for a left move if (direction == "l"): return Location(current_row, current_column - 1) # Calculate t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNewLocation(self, currentLocation, directionalMovement):\n x = currentLocation[0] + directionalMovement[0]\n y = currentLocation[1] + directionalMovement[1]\n return (x, y)", "def get_location(self, currentlocation, action):\n\t\t# Retrieve movement tuple from dictionary\n\t\tmovement...
[ "0.6761584", "0.65838546", "0.6551763", "0.6501945", "0.6485612", "0.6441349", "0.6333201", "0.623619", "0.62274575", "0.6121013", "0.6087272", "0.60715115", "0.60713834", "0.6050827", "0.6002279", "0.59576184", "0.5944363", "0.59366095", "0.5923641", "0.59176326", "0.5860694...
0.8537776
0
Mover Function Moves the path to a new location.
def move(self, direction): # Ensure the move is valid assert self.is_move_valid(direction), "Tried to make an invalid move" # Calculate the move location. self._current_loc = self._calculate_move_location(direction) # Update the path. self._path.append(self._current_loc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, path):\n self.current_location = (path[1][1], path[1][0])", "def move_by(self, path, env=None):\n env = self._find_env(env)\n old_pos = self.position(env)\n new_pos = [p + c for p, c in zip(old_pos, path)]\n env.move_agent(self, new_pos)", "def move(self, new_p...
[ "0.7614908", "0.6925959", "0.69229007", "0.6762728", "0.665183", "0.6649759", "0.65716606", "0.65481114", "0.6428406", "0.64077437", "0.6395367", "0.63458943", "0.63458943", "0.6343252", "0.63418186", "0.6317858", "0.6307312", "0.6253887", "0.62428087", "0.621114", "0.6158344...
0.6371334
11
Goal Checker This function checks if the goal has been reached.
def is_at_goal(self): return self._current_loc.get_row() == BoardPath._goal_loc.get_row() and \ self._current_loc.get_column() == BoardPath._goal_loc.get_column()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkGoal(self):\n # -- It is not included for simplifity --#\n if self.reward_cumulative != None:\n x = round((abs(self.reward_cumulative) - abs(round(self.reward_cumulative))) * 100);\n rem_goal = x % 25\n rem_timeout = x % 20\n if rem_goal == 0 and x...
[ "0.8073732", "0.8071885", "0.77985656", "0.7331105", "0.7092723", "0.70926803", "0.7066472", "0.69500685", "0.6914559", "0.6880784", "0.68365633", "0.6739718", "0.6722361", "0.6709348", "0.6690268", "0.66785365", "0.666108", "0.666108", "0.6649259", "0.66438985", "0.6612663",...
0.6985418
7
Goal Setter This function sets the goal for the board.
def set_goal(goal_loc): BoardPath._goal_loc = goal_loc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_goal(self, goal: GoalType) -> None:\n self.goal = goal", "def goal(self, goal):\n\n self._goal = goal", "def set_goal(self, goal):\r\n self.goal = goal\r\n self.start_time = self.get_current_time()", "def set_goal(self, **kwargs):\n return self.env.set_goal(**kwargs...
[ "0.7807485", "0.7740968", "0.75928867", "0.753877", "0.7105755", "0.69478315", "0.6941798", "0.66204673", "0.6585629", "0.64913666", "0.63631916", "0.6287369", "0.62222", "0.6091264", "0.6044519", "0.59357023", "0.59132695", "0.5908332", "0.5907529", "0.58134097", "0.5791385"...
0.7828492
0
Untraversed Board Setter This function stores the untraversed board configuration.
def set_untraversed_board(board): BoardPath._untraversed_board = board
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resetBoard(self):\n pass", "def reset(self, board):", "def reset_board(self):\n\n self.board = np.array(self.initial_board)", "def resetBoard(self):\n\t\tself.board = np.zeros((self.boardSize,self.boardSize))", "def resetBoard(self):\n\t\tself.board = np.zeros((self.boardSize,self.boardSi...
[ "0.65023744", "0.6442172", "0.63471204", "0.63091016", "0.63091016", "0.6104631", "0.6043555", "0.5902821", "0.58919376", "0.5850664", "0.58014584", "0.57706535", "0.57347137", "0.5697121", "0.56899226", "0.5621945", "0.5598106", "0.5597589", "0.5568787", "0.5554146", "0.5552...
0.7495511
0
Traversed Board Setter This function stores the traversed board configuration.
def set_traversed_board(board): BoardPath._traversed_board = board # Extract the size of the traversed board # This is stored and used in "made_up" heuristic analysis BoardPath._traversed_board_size = 0 for board_row in board: BoardPath._traversed_board_size += len(bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_board(board):", "def setBoard(self, board):\n\t\tself.gameBoard = board", "def set_board(self, configuration):\n self._config = list(configuration)\n self._houses_num = len(configuration)\n \n tmp_houses = list(configuration)\n tmp_houses.reverse()\n \n ...
[ "0.6318433", "0.6227784", "0.6074598", "0.59444225", "0.5924237", "0.57436174", "0.5697527", "0.5650028", "0.5642821", "0.564118", "0.5608471", "0.5591121", "0.5589941", "0.5576632", "0.54089105", "0.53993165", "0.5385703", "0.536131", "0.53228533", "0.532268", "0.5311601", ...
0.6119311
2
Heuristic Setter This function stores the board path heuristic
def set_heuristic(heuristic): BoardPath._heuristic = heuristic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heuristic(self):\r\n # 1.\r\n blacks, whites = 0, 0\r\n weights = [0 for _ in range(6)]\r\n directions = [[-1, -1], [-1, 1], [1, 1], [1, -1]]\r\n user_dir = directions[:2] if self.current_player == 'n' else directions[2:]\r\n for i in range(8):\r\n for j in ...
[ "0.72173494", "0.7166709", "0.68784773", "0.68497974", "0.6678026", "0.6647084", "0.6623912", "0.6621537", "0.6619162", "0.65451026", "0.6475537", "0.6408203", "0.6355258", "0.631753", "0.62351453", "0.6221724", "0.6215816", "0.6163034", "0.61629605", "0.61505026", "0.6150489...
0.77581763
0
Path Printer This function prints the object's path through the path to the console
def print_path(self): temp_board = self._untraversed_board step_numb = 0 prev_row = -1 prev_col = -1 # Iterate through each board configuration. for loc in self._path: # Depending on if this is the initial setup or not # Process the next print out....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n\n return self.print_path([])", "def printPath(path):\r\n result = ''\r\n for i in range(len(path)):\r\n result = result + str(path[i])\r\n if i != len(path) - 1:\r\n result = result + '->'\r\n return result", "def __str__(self):\n return \"\...
[ "0.7480165", "0.7081566", "0.7079112", "0.70077777", "0.69893605", "0.6977167", "0.69615716", "0.68941194", "0.6790297", "0.6766931", "0.6659395", "0.65597045", "0.6550416", "0.6519578", "0.6499361", "0.6494377", "0.637156", "0.63513625", "0.63493174", "0.6345297", "0.6338126...
0.6851385
8
Less Than Operator Less than operator used for the distance of two BoardPath objects.
def __lt__(self, other): return self.get_distance() < other.get_distance()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __lt__(self, other):\n return self.lessThan(other)", "def less(lhs, rhs):\n return _make.less(lhs, rhs)", "def __lt__(self, other):\n return self.dist_from_source < other.dist_from_source", "def __lt__(self, other):\n return self.abs2phy.__lt__(other)", "def __lt__(self, other):...
[ "0.70282334", "0.69592035", "0.6899089", "0.68775755", "0.68775755", "0.6856517", "0.6844349", "0.6821911", "0.67643285", "0.6722422", "0.6687183", "0.6684212", "0.6676479", "0.6667317", "0.6630886", "0.66158414", "0.6570471", "0.65577924", "0.65521175", "0.65098625", "0.6481...
0.7412242
0
Row Number Accessor Accessor to get the row number of this location.
def get_row(self): return self._row_number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row_counter(self) -> int:\n return self.writer.row_counter", "def row(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"row\")", "def row(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"row\")", "def row(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"row...
[ "0.75195545", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74487907", "0.74372005", "0.74104637", "0.74104637", "0.7353418",...
0.81669563
0
Column Number Accessor Accessor to get the column number of this location.
def get_column(self): return self._column_number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column(self) -> int:\n return self._column", "def get_column(self, pos, **opts):\n lnum, cnum = self._get_column(pos, **opts)\n return lnum + self.LINE_NUM_BASE, cnum + self.COLUMN_NUM_BASE", "def column(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"column\")", "def ...
[ "0.784214", "0.7419771", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.7389335", "0.71282494", "0.6932579", "0.6846213", "0.68336886", ...
0.82080346
0
Valid Location Checker Checks whether this location is valid.
def is_valid(self): if self.get_row() != -1 and self.get_column() != -1: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(self):\n for location in self.locations.values():\n if not location.is_valid:\n return False\n return True", "def clean_location(self):\n location = self.cleaned_data['location']\n\n matching_ids = get_all_matching_location_ids(location)\n ...
[ "0.6865433", "0.65096635", "0.64228725", "0.6274094", "0.6223627", "0.61751413", "0.61403114", "0.6098187", "0.6028773", "0.5820583", "0.58124954", "0.58024067", "0.5796383", "0.57874674", "0.57832456", "0.57574135", "0.57457554", "0.57377124", "0.5665434", "0.56494164", "0.5...
0.0
-1
Special function for == operator
def __eq__(self, other): # Ensure same class and values match if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(x, y):\n return x == y", "def is_equal(self, a, b):\n return a == b", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\...
[ "0.77434087", "0.7511841", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555", "0.75031555",...
0.0
-1
Special function for != operator
def __ne__(self, other): return not (self == other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, rhs):\n return not self.__eq__(rhs)", "def __ne__(left, right):\n return (not (left == right))", "def __ne__(self, other):\n return not self.__eq__(other)", "def __ne__(self, other):\n return not (self == other) # opposite of __eq__", "def __ne__(self, othe...
[ "0.8012074", "0.7888594", "0.7855215", "0.7828879", "0.779572", "0.7794179", "0.7726372", "0.7711095", "0.76889086", "0.76813257", "0.7669499", "0.7669306", "0.76685494", "0.76685494", "0.76685494", "0.76685494", "0.7649886", "0.76432693", "0.7642552", "0.7642552", "0.762906"...
0.0
-1
Lists the member teams.
def teams(request): if request.method == 'GET': # Validates if the member exists. If members logon successfully they are created on the teams-app. email = request.session.get('email', None) full_name = request.session.get('full_name', None) try: member = Member.objects.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teams(self):\r\n url = '{0}/{1}'.format(self.get_url(), 'teams')\r\n\r\n return http.Request('GET', url), parsers.parse_json", "def getAllTeams(self):\n return []", "def team_list(request):\n template = loader.get_template('team/team_list.html')\n teams_list = Team.objects.all()....
[ "0.759812", "0.75281477", "0.74621797", "0.74324244", "0.74222827", "0.7367157", "0.725578", "0.7211295", "0.71726364", "0.71253264", "0.70860684", "0.7013575", "0.6984913", "0.6915943", "0.6838619", "0.68201035", "0.6818231", "0.67570263", "0.6731368", "0.6731368", "0.669519...
0.72662145
6
Adds a selected team to the member teams list.
def update_member_teams(request, team_name): if request.method == 'GET': email = request.session.get('email', None) member = Member.objects.get(email=email) all_teams = Team.objects.all() for team in all_teams: if team.name == team_name: member.teams.add(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def add_to_team(self, player : Player, team):\r\n if player in self.remaining:\r\n self.teams[team].append(player)\r\n self.remaining.remove(player)\r\n return discord.Embed(title=\"Valorant 10 Man Bot\",\r\n description=\"{} has been drafted to team {}\...
[ "0.6469067", "0.6444061", "0.6429615", "0.64136", "0.6323522", "0.62817746", "0.62376755", "0.62157303", "0.6175544", "0.61600906", "0.61417055", "0.613774", "0.6088733", "0.6083329", "0.6033315", "0.6011394", "0.5988793", "0.59338915", "0.592007", "0.5912118", "0.5909751", ...
0.6332764
4
Creates a team. It doesn't relates member and teams, so users have to use the really cool search feature.
def create_team(request): if request.method == 'POST': email = request.session.get('email', None) team_name = request.POST.get('team_name', None) team = Team(name=team_name) team.save() message = "Team created, please use the cool search feature and assign yourself to the te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n req = team_req.parse_args(strict=True)\n curr_user = api.user.get_user()\n if curr_user[\"teacher\"]:\n raise PicoException(\"Teachers may not create teams\", 403)\n req[\"team_name\"] = req[\"team_name\"].strip()\n if not all(\n [\n ...
[ "0.8057657", "0.77950835", "0.7587349", "0.7408502", "0.7399746", "0.7387658", "0.7241044", "0.72111934", "0.71348476", "0.71306115", "0.7128486", "0.70897", "0.7060156", "0.70001376", "0.6890768", "0.6879242", "0.68079567", "0.674662", "0.6741851", "0.6687012", "0.66641074",...
0.7286078
6
Function to return user_song_list_count which has data of all users and the count of songs the user has listened to.
def preprocessing(): track_metadata = pd.read_csv('/home/sachet/Artificial Intelligence/song_data.csv') count_play = pd.read_csv('/home/sachet/Artificial Intelligence/10000.txt', sep='\t', header=None, names=['user','song','play_count']) unique_track_metadata = track_metadata.groupby('song_id').max().reset_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_count(username):\n return get_contributor(username)[\"count\"]", "def user_counts(user_id):\n return _fetch_records(f\"SELECT rating_type, count FROM counts_by_rating_type WHERE user_id = {user_id} AND count > 0\")", "def get_counts(self, obj: User):\n uploader = obj.id\n public_cou...
[ "0.6450388", "0.62384784", "0.621782", "0.62003124", "0.6174985", "0.6170376", "0.61630744", "0.6100274", "0.60886586", "0.6022709", "0.59969884", "0.5996942", "0.5968442", "0.5961288", "0.5941371", "0.5929401", "0.5906927", "0.5895797", "0.5879137", "0.58469474", "0.5841158"...
0.5567753
39
Rotates the point around the X axis by the given angle in degrees.
def rotateX(self, angle): rad = math.radians(angle) cosa = math.cos(rad) sina = math.sin(rad) y = self.y * cosa - self.z * sina z = self.y * sina + self.z * cosa return Point3D(self.x, y, z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_x(self, angle):\n angle *= np.pi / 180\n return self.transform(np.matrix([[1, 0, 0],\n [0, np.cos(angle), -np.sin(angle)],\n [0, np.sin(angle), np.cos(angle)]]))", "def rotate_x(self, angle:...
[ "0.7946597", "0.75407946", "0.7309387", "0.7100913", "0.70926636", "0.70239174", "0.6984318", "0.6948638", "0.6939483", "0.68799853", "0.687543", "0.6835535", "0.6781335", "0.6731041", "0.6605782", "0.65896446", "0.6499886", "0.64935017", "0.6486113", "0.64761364", "0.6472282...
0.64040524
27
Rotates the point around the Y axis by the given angle in degrees.
def rotateY(self, angle): rad = math.radians(angle) cosa = math.cos(rad) sina = math.sin(rad) z = self.z * cosa - self.x * sina x = self.z * sina + self.x * cosa return Point3D(x, self.y, z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_y(self, angle):\n angle *= np.pi / 180\n return self.transform(np.matrix([[np.cos(angle), 0, np.sin(angle)],\n [0, 1, 0],\n [-np.sin(angle), 0, np.cos(angle)]]))", "def rotate_y...
[ "0.78093827", "0.75357753", "0.7415357", "0.72273874", "0.6876136", "0.6802425", "0.6794168", "0.6675276", "0.66429347", "0.6481192", "0.6430551", "0.63396794", "0.6271535", "0.62343675", "0.61944264", "0.6171163", "0.6093572", "0.60700744", "0.6050427", "0.604153", "0.602756...
0.59002674
25
Rotates the point around the Z axis by the given angle in degrees.
def rotateZ(self, angle): rad = math.radians(angle) cosa = math.cos(rad) sina = math.sin(rad) x = self.x * cosa - self.y * sina y = self.x * sina + self.y * cosa return Point3D(x, y, self.z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotateZ(self, angle):\r\n rad = angle * math.pi / 180\r\n cosa = math.cos(rad)\r\n sina = math.sin(rad)\r\n x = self.x * cosa - self.y * sina\r\n y = self.x * sina + self.y * cosa\r\n return Point3D(x, y, self.z)", "def rotateZ(self, angle):\n rad = angle * ma...
[ "0.82258207", "0.8223098", "0.8223098", "0.8223098", "0.8223098", "0.8217796", "0.80511457", "0.7841674", "0.7492067", "0.7388943", "0.72343695", "0.72204983", "0.70974624", "0.70917773", "0.7034674", "0.7019151", "0.6976446", "0.69459265", "0.6892008", "0.6891864", "0.674605...
0.8195645
6
Transforms this 3D point to 2D using a perspective projection.
def project(self, win_width, win_height, fov, viewer_distance): factor = fov / (viewer_distance + self.z) x = self.x * factor + win_width / 2 y = -self.y * factor + win_height / 2 return Point3D(x, y, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_point(self, point: Point3D) -> Point3D:\n x, y, z = point\n cam_x, cam_y, cam_z = self._pos\n x -= cam_x\n y -= cam_y\n z -= cam_z\n dx = self._cy*(self._sz*y + self._cz*x) - self._sy*z\n dy = self._sx*(self._sy*(self._sz*y + self._cz*x) + self._cy*z) + ...
[ "0.7485761", "0.7218691", "0.6950993", "0.6886399", "0.68223923", "0.66571516", "0.6603911", "0.65672183", "0.6495761", "0.64801496", "0.6474243", "0.6377783", "0.6376653", "0.6376052", "0.6375711", "0.63709044", "0.6364304", "0.63624424", "0.63512695", "0.63367707", "0.63009...
0.62003535
30
Get coordinates from input mol, and generate/format input text for Psi4 calculation.
def make_psi_input(mol, label, method, basisset, calctype='opt', mem=None): # check that specified calctype is valid check_calc(calctype) inputstring = "" # specify memory requirements, if defined if mem != None: inputstring += "memory %s\n" % mem inputstring += ('molecule %s {\n' % l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def molToPsi4(self):\n mol = self.molfile\n mol = Chem.AddHs(mol)\n AllChem.EmbedMolecule(mol, useExpTorsionAnglePrefs=True, useBasicKnowledge=True)\n AllChem.UFFOptimizeMolecule(mol)\n atoms = mol.GetAtoms()\n string = string = \"\\n\"\n for i, atom in enumerate(at...
[ "0.6875006", "0.62146163", "0.61228514", "0.54665756", "0.53889376", "0.5295396", "0.5280031", "0.5270912", "0.51930785", "0.51587594", "0.5158178", "0.5153392", "0.5149018", "0.5137124", "0.5098608", "0.5091383", "0.50637925", "0.5058507", "0.50482875", "0.50428116", "0.5032...
0.50096345
22
THIS FUNCTION IS A WORK IN PROGRESS. Get coordinates from input mol, and generate/format input text for Psi4 calculation via JSON wrapper.
def make_psi_json(mol, label, method, basisset, calctype='opt', mem=None): # check that specified calctype is valid check_calc(calctype) inputdict = {} moldict = {} modeldict = {} keydict = {} inputdict["schema_name"] = "qc_schema_input" inputdict["schema_version"] = 1 # specify me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def molToPsi4(self):\n mol = self.molfile\n mol = Chem.AddHs(mol)\n AllChem.EmbedMolecule(mol, useExpTorsionAnglePrefs=True, useBasicKnowledge=True)\n AllChem.UFFOptimizeMolecule(mol)\n atoms = mol.GetAtoms()\n string = string = \"\\n\"\n for i, atom in enumerate(at...
[ "0.6123903", "0.55045384", "0.5481912", "0.54539114", "0.5443194", "0.54166734", "0.54024506", "0.5377121", "0.53512585", "0.53508705", "0.5325877", "0.5307904", "0.5301415", "0.5284678", "0.5265575", "0.52480125", "0.52115595", "0.5199945", "0.5173829", "0.5150477", "0.51422...
0.5171564
19
Read in molecule(s) (and conformers, if present) in insdf file. Create Psi4 input calculations for each structure.
def confs_to_psi(insdf, method, basis, calctype='opt', memory=None, via_json=False): wdir = os.getcwd() # open molecules molecules = reader.read_mols(insdf) ### For each molecule: for each conf, generate input for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_single_sdf_to_pdb(pdb_subfolder_path, sdf_file_path):\n\n if os.path.exists(sdf_file_path) is True:\n\n file_basename = basename(sdf_file_path)\n file_basename = file_basename.split(\"__input1\")[0]\n\n file_output_name = \"{}{}_\".format(pdb_subfolder_path, file_basename)\n\n ...
[ "0.6264046", "0.59976745", "0.58319986", "0.5608725", "0.56042486", "0.55735916", "0.5559321", "0.5514504", "0.5502829", "0.5502089", "0.54991895", "0.5464917", "0.5451997", "0.5418302", "0.54164004", "0.54018366", "0.53971356", "0.5395792", "0.53391236", "0.5336778", "0.5336...
0.6674122
0
Extract a date from the JSON filing, at the provided path.
def get_date(filing: Dict, path: str) -> date: try: raw = dpath.util.get(filing, path) return date.fromisoformat(raw) except (IndexError, KeyError, TypeError, ValueError): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromJSON(self, path='') -> dict:\n try:\n return(importJSON(path))\n except Exception as error:\n print(f\"Error: self.fromJSON({path}) -> {error}\")", "def parse_data_from_file(path):\n print(path.stem)\n \n raw = path.stem.split('-')\n\n rawdate = raw[0][2:]\...
[ "0.6075106", "0.5673903", "0.56059843", "0.5590737", "0.55821204", "0.5564711", "0.55302495", "0.54868776", "0.54759276", "0.54637516", "0.5429487", "0.5429347", "0.5408953", "0.5400296", "0.53059995", "0.530356", "0.52951413", "0.5294175", "0.5283827", "0.5268045", "0.523605...
0.6837925
0
Extract a str from the JSON filing, at the provided path.
def get_str(filing: Dict, path: str) -> str: try: raw = dpath.util.get(filing, path) return str(raw) except (IndexError, KeyError, TypeError, ValueError): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json_str(self):\n\n with open(self.path, mode='r', encoding='utf-8') as file:\n return file.read()", "def actual(self, path: str):\n nodes = path.split('.')\n resp_json = self.json\n for node in nodes:\n resp_json = resp_json.get(node)\n return res...
[ "0.6552176", "0.6368723", "0.62871057", "0.62073576", "0.6198753", "0.61034834", "0.5978531", "0.5907652", "0.59014565", "0.5865438", "0.58326775", "0.58097404", "0.5789452", "0.5682722", "0.56802696", "0.5669492", "0.5638627", "0.5630336", "0.56209874", "0.5619586", "0.56013...
0.6647993
0
Extract a boolean from the JSON filing, at the provided path.
def get_bool(filing: Dict, path: str) -> str: try: raw = dpath.util.get(filing, path) return bool(raw) except (IndexError, KeyError, TypeError, ValueError): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boolean_value(cls, json_field: str, value: bool) -> \"JsonPattern\":\n return jsii.sinvoke(cls, \"booleanValue\", [json_field, value])", "def getBool( self, par, path ):\n\n return self.db.getBoolPar( par, path )", "def is_json_path(location):\n if filetype.is_f...
[ "0.6071287", "0.57850856", "0.5647551", "0.55946714", "0.5420584", "0.5406428", "0.5285786", "0.5227173", "0.52162", "0.51716995", "0.5158244", "0.5113517", "0.51068", "0.50923777", "0.509074", "0.5047108", "0.50103277", "0.49863604", "0.49533832", "0.4951799", "0.49441293", ...
0.7121972
0
quote src to string
def _quote(src, encoding="utf-8"): if isinstance(src, unicode): src = src.encode(encoding) return urllib.quote(src)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replacement(self):\n assert (self.src or self.inline) and not (self.src and self.inline)\n if self.src:\n return '<script async type=\"text/javascript\" src=\"%s\"></script>' % urllib.quote(self.src)\n else:\n return '<script>\\n%s\\n</script>' % self.inline", "def Sourceify(path):\n retu...
[ "0.5974841", "0.58601075", "0.5774958", "0.5739309", "0.561575", "0.5580705", "0.5553651", "0.5544228", "0.5541506", "0.548759", "0.5487165", "0.54729", "0.5467639", "0.54428", "0.54321027", "0.5386833", "0.53533804", "0.53520805", "0.5338085", "0.53334767", "0.5330983", "0...
0.6619573
0
unquote str to url
def _unquote(src, encoding="utf-8"): return urllib.unquote(src).decode(encoding)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urldecode(val):\n return urllib2.unquote(val)", "def urldecode(val):\n return urllib.unquote_plus(val)", "def quote_uri(uri):\n import urlparse\n import urllib\n\n up=urlparse.urlparse(uri)\n np=urllib.quote(up[2])\n return urlparse.urlunparse((up[0],up[1],np,up[3],up[4],up[5]))", "def...
[ "0.7064307", "0.7051374", "0.6763194", "0.6752534", "0.66290367", "0.65754646", "0.6573373", "0.6551047", "0.65141356", "0.6489508", "0.6452029", "0.6445967", "0.6365435", "0.6339722", "0.62543184", "0.6241144", "0.620201", "0.61938894", "0.6175648", "0.61493933", "0.612075",...
0.65834916
5
decorator for get method register
def get(url): url = add_slash(url) def _(func): re_url = re.compile("^%s$" % url) REQUEST_MAPPINGS['GET'].append((re_url, url, func)) return func return _
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, *args, **kwargs):", "def get(self, *args):", "def __get__(*args, **kwargs):\n \n pass", "def __get__(*args, **kwargs):\n \n pass", "def handle_get(cls, **kwargs):\n raise NotImplementedError", "def __call__(self, *args, **kwargs):\n return self.get(*args, *...
[ "0.68309295", "0.6675848", "0.6626815", "0.6626815", "0.66126513", "0.6610192", "0.6610192", "0.6586184", "0.6586184", "0.6536064", "0.65258396", "0.645564", "0.6337337", "0.63317025", "0.63232625", "0.62869775", "0.62707186", "0.6268726", "0.62609226", "0.62609226", "0.62550...
0.5364231
97
decorator for post method register
def post(url): url = add_slash(url) def _(func): re_url = re.compile("^%s$" % url) REQUEST_MAPPINGS['POST'].append((re_url, url, func)) return func return _
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n self.finish(self.register())", "def _post_dispatch(self, request, *args, **kwargs):\n pass", "def after_request(self, func: typing.Callable):\n return self.add_hook(type_=\"post\", hook=func)", "def post(self):", "def post():\n raise NotImplementedError", "def ha...
[ "0.6869386", "0.67186683", "0.6587866", "0.65795", "0.6578321", "0.65417224", "0.6537671", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.642135", "0.63676924", ...
0.0
-1
Parses the content of a file.
def parse(self, path, is_test_instance=False): assert os.path.exists(path) samples = [] with open(path, 'r') as f: for line in f: instance = Instance() if is_test_instance: instance.add_sentence(line, self.dictionary, is_test_insta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(self, file):\n return self.parse(file.read())", "def parse_file(self, file_name: str):\n if not os.path.exists(file_name):\n log.error('File {} does not exist'.format(file_name))\n return None\n try:\n with open(file_name) as file:\n ...
[ "0.73819876", "0.71874154", "0.7125175", "0.70569646", "0.69479567", "0.6932132", "0.6914554", "0.6875423", "0.6741799", "0.67292744", "0.670316", "0.6673647", "0.6659528", "0.6657381", "0.66160166", "0.66102195", "0.660509", "0.6532565", "0.65184915", "0.65127826", "0.649885...
0.0
-1
Tokenizes a text file.
def tokenize(self, path): assert os.path.exists(path) # Add words to the dictionary with open(path, 'r') as f: tokens = 0 lines_c = 0 for line in f: words = ['<start>'] + line.split() + ['<eos>'] len_ = len(words) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_file(filename):\n filename, text = read_file(filename)\n token_text = word_tokenize(text)\n return filename, token_text", "def tokenize_text_file(path, sanitize=True, remove_duplicates=False, stopwords=None):\n with open(path, 'r') as f:\n text_string = f.read()\n tokens = ...
[ "0.7719976", "0.75545526", "0.7165831", "0.7099891", "0.69710827", "0.6951215", "0.6950511", "0.69196737", "0.6892084", "0.6843397", "0.68261045", "0.68261045", "0.68049693", "0.6728787", "0.6702082", "0.66849124", "0.66235036", "0.6609853", "0.6596192", "0.6591185", "0.65899...
0.6815363
12
Return the expected keys for the log entry.
def expected_log_keys(learner: adaptive.BaseLearner) -> list[str]: # Check if the result contains the expected keys expected_keys = [ "elapsed_time", "overhead", "npoints", "cpu_usage", "mem_usage", ] if not _at_least_adaptive_version("0.16.0", raises=False) and n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self, entry_type:str, x:str):\n keys = set()\n x = self._decode(x)\n\n for log in self.logs:\n for datum in log[entry_type]:\n res = self._follow(datum, x)\n\n if type(res) == dict:\n for key in res.keys():\n ...
[ "0.6501111", "0.62000287", "0.61273104", "0.61169225", "0.6086626", "0.60766816", "0.60219604", "0.6018274", "0.5984301", "0.5967556", "0.5930063", "0.5905795", "0.5868908", "0.586158", "0.5827901", "0.57728463", "0.5768729", "0.5760981", "0.5749968", "0.5745742", "0.5743827"...
0.71414775
0
Make a representation of object that is easy to find in corpus.
def friendly_id(self): id = f"{self.annotator_id}_{self.document_title.split('_')[0]}" try: # try making an sentence identifier if there is an in_sentence attrib sen_id = ",".join(str(se.element_id + 1) for se in self.in_sentence) id += f"_s{sen_id}" except Exception as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return ''.joint(\"A corpus made of \", len(self._corpus),\n \" with types: \", [type(item) for item in self._corpus])", "def build(self, obj):\n if isinstance(obj, self.art_type):\n return obj\n elif isinstance(obj, (tuple, list, dict, ...
[ "0.6311109", "0.6053932", "0.5645673", "0.56127447", "0.5482682", "0.54713523", "0.5400021", "0.53901446", "0.5380758", "0.5339382", "0.5327804", "0.5323678", "0.53051144", "0.53021866", "0.5297798", "0.52929544", "0.52819115", "0.52755284", "0.5261796", "0.5260795", "0.52493...
0.0
-1
Return the Spacy processed sentences in which the element is positioned.
def get_processed_sentence(self): if not hasattr(self, "in_sentence"): raise AttributeError(f"{self} does not have attribute 'in_sentence'.") try: sen_ixs = [sen.element_id for sen in self.in_sentence] except TypeError as e: sen_ixs = [self.in_sentence.eleme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentences(self) -> List[str]:\n\t\treturn [self.text[start:end] for start, end in self.tokenizations]", "def sentences(self) -> List[str]:\n\t\treturn [self.text[start:end] for start, end in self.tokenizations]", "def get_sentences(self):\n return [s for s in self.text.split('\\n')]", "def get_pro...
[ "0.69350046", "0.69350046", "0.6880929", "0.68049884", "0.6687255", "0.6577726", "0.64769137", "0.6395686", "0.6395686", "0.6374306", "0.63575345", "0.6353244", "0.6340651", "0.62586695", "0.6229776", "0.622054", "0.6184957", "0.61654425", "0.6101179", "0.6096108", "0.6073652...
0.7071078
0
Check if the annotation is pronominal by full parsed PoS tag. All tokens should be pronominal (works best for anaphoric pronominal mentions as intended).
def check_pronominal(self): pronom_tags = ["PRP", "PRP$", "WDT", "WP", "WP$"] token_procs = self.get_processed_tokens() all_pronom = all( t.tag_ in pronom_tags for t in token_procs ) # True if all tokens are pronom_tags # print(f"{' '.join(t.text + '.' + t.tag_ for t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_pronoun(cluster):\n for mention in cluster:\n if any([w.tag_.startswith(\"PRP\") for w in mention]):\n # Found a mention with a pronoun\n return True\n return False", "def find_pronoun(sent):\n pronoun = None\n\n for word, part_of_speech in sent.pos_tags:\n ...
[ "0.61451167", "0.58428335", "0.5761659", "0.55204415", "0.542974", "0.53121424", "0.52965194", "0.5273935", "0.5249292", "0.5238592", "0.52133167", "0.5151928", "0.5150011", "0.5145963", "0.5134433", "0.5119308", "0.5116591", "0.50993526", "0.5094933", "0.5078213", "0.5075910...
0.72758985
0
Replace annotation unit by its Canonical referent.
def replace_by_canonical_referent(self, cross_sentence=True): replaced_count = 0 # replace the participant in their containers def replace_in_containers(myobj, replacing): containers = { "event": "participants", "sentiment_expression": "targets", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitized(self) -> AnnotationWrapper:\n res = self.replace('typing.', ''). \\\n replace('telegrambotapiwrapper.typelib.', ''). \\\n replace(\"<class '\", \"\"). \\\n replace(\"'>\", \"\")\n return AnnotationWrapper(res)", "def copy_annotations(source: str, targe...
[ "0.5260051", "0.5162772", "0.5024999", "0.50209576", "0.50172675", "0.49961436", "0.49337363", "0.49098545", "0.4908495", "0.48858345", "0.48811057", "0.48475933", "0.48307392", "0.48301882", "0.4786552", "0.47759408", "0.4762112", "0.4751336", "0.4724744", "0.47108185", "0.4...
0.4454109
49
Custom repr for easier debugging.
def __repr__(self): text = str(self) text_ellips = (text[:31] + ".." + text[-31:]) if len(text) > 64 else text return f"{self.element_id}. {text_ellips}..."
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\r\n return repr(self)", "def __repr__(self) -> str:\n items = (\"{}={}\".format(k, repr(v)) for k, v in self.__dict__.items())\n return \"<{}({})>\".format(self.__class__.__name__, \", \".join(items))", "def __str__(self):\n return repr(self)", "def __repr__(sel...
[ "0.82584816", "0.8253082", "0.82329077", "0.8191106", "0.81365615", "0.81327766", "0.81327766", "0.81327766", "0.8118914", "0.8113123", "0.80449194", "0.80449194", "0.80449194", "0.80449194", "0.80425906", "0.801727", "0.7994082", "0.79937655", "0.798417", "0.79790634", "0.79...
0.0
-1
Get a list of token objects for the event extent. The extent can be set to include discontiguous_triggers, participants, and/or fillers. Setting this to an empty list will only return the original In the definition of an event nugget we include all of these.
def get_extent_tokens(self, extent=["discontiguous_triggers"], source_order=True): all_tokens = self.tokens.copy() core_sen_idx = all_tokens[0].in_sentence.element_id # to ensure discont is in same sentence for ext in extent: if getattr(self, ext): all_tokens.extend(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_extent_tokens(self, extent=[], source_order=True):\n all_tokens = self.tokens.copy()\n\n for ext in extent:\n if getattr(self, ext):\n all_tokens.extend(t for x in getattr(self, ext) for t in x.tokens)\n\n all_tokens = list(\n set(all_tokens)\n ...
[ "0.77589923", "0.6758597", "0.64047307", "0.6147929", "0.60916317", "0.6056437", "0.5989617", "0.58163434", "0.58126074", "0.56831574", "0.567847", "0.56537056", "0.55833375", "0.54851276", "0.54851276", "0.54851276", "0.5463045", "0.5441857", "0.54370433", "0.53718114", "0.5...
0.7712019
1
Get a list of token ids for the event extent. Relies on Event.get_extent_tokens() for fetching the tokens.
def get_extent_token_ids(self, **kwargs): token_span = self.get_extent_tokens(**kwargs) return [t.index for t in token_span]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_extent_tokens(self, extent=[], source_order=True):\n all_tokens = self.tokens.copy()\n\n for ext in extent:\n if getattr(self, ext):\n all_tokens.extend(t for x in getattr(self, ext) for t in x.tokens)\n\n all_tokens = list(\n set(all_tokens)\n ...
[ "0.7306065", "0.7179015", "0.67308676", "0.66366893", "0.6510626", "0.63861024", "0.6332538", "0.6213533", "0.6002818", "0.59769213", "0.59459466", "0.58939326", "0.58939326", "0.58939326", "0.5877605", "0.58751804", "0.58647084", "0.5804137", "0.5802045", "0.5801702", "0.578...
0.85507065
0
Get a list of token objects for the sentiment expression extent. The extent can be set to include targets. Setting this to an empty list will only return the original tokens.
def get_extent_tokens(self, extent=[], source_order=True): all_tokens = self.tokens.copy() for ext in extent: if getattr(self, ext): all_tokens.extend(t for x in getattr(self, ext) for t in x.tokens) all_tokens = list( set(all_tokens) ) # this i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_extent_tokens(self, extent=[\"discontiguous_triggers\"], source_order=True):\n all_tokens = self.tokens.copy()\n core_sen_idx = all_tokens[0].in_sentence.element_id # to ensure discont is in same sentence\n\n for ext in extent:\n if getattr(self, ext):\n all_t...
[ "0.79144996", "0.66847426", "0.64567703", "0.64525014", "0.6422023", "0.63470286", "0.6025481", "0.5879312", "0.5853642", "0.58203405", "0.58203405", "0.55929494", "0.5589577", "0.55816835", "0.5545209", "0.553422", "0.54197466", "0.54197466", "0.54197466", "0.5392735", "0.53...
0.82137984
0
Set token id based on document id + token position in text
def get_token_id(self): return f"{self.document_title}_{self.index}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_token_begin_position(self, tokens, text):\n beginning = 0\n for token in tokens:\n token.text_begin = text.find(token.text_content, beginning) \n beginning += len(token.text_content)\n return tokens", "def doc2id(self, doc):\n doc = map(self.process_t...
[ "0.61441404", "0.6103226", "0.60713357", "0.58848673", "0.58489716", "0.5830993", "0.5819702", "0.5808241", "0.5795522", "0.57590806", "0.5744294", "0.5744294", "0.5727401", "0.57221353", "0.57152474", "0.56934476", "0.568862", "0.56846684", "0.5665206", "0.5659678", "0.56587...
0.7065767
0
Append value to attribute list, create the attribute list if does not exist.
def append_attribute(myobj, attrib_k, val): vals = getattr(myobj, attrib_k, []) if val not in vals: vals.append(val) setattr(myobj, attrib_k, vals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setAttribute(self, attribute, value):\n\n # if multiple values found\n if hasattr(self, attribute):\n\n # make sure attribute is a list\n values = getattr(self, attribute)\n if not isinstance(values, list):\n setattr(self, attribute, [values])\n\n ...
[ "0.72828615", "0.7063005", "0.70154303", "0.6982224", "0.6949298", "0.6837699", "0.66487557", "0.6644792", "0.660447", "0.6597281", "0.65214103", "0.64085853", "0.639992", "0.6395541", "0.63902277", "0.6352462", "0.6338568", "0.63299024", "0.63299024", "0.63299024", "0.632369...
0.74247986
0
Function to converts XML attributes into a dictionary
def __convertAttributes__(xml_source): attributes = {} for attrName, attrValue in xml_source.attributes.items(): attributes[attrName] = attrValue return attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attrs_dict(self, root_element):\n attr_elements = root_element.findall(\"attribute\")\n attrs_dict = {}\n for el in attr_elements:\n attrs_dict[el.attrib[\"name\"]] = {\n \"value\": el.attrib[\"value\"],\n \"type\": el.attrib.get(\"type\", None)...
[ "0.7548967", "0.722563", "0.71245855", "0.711149", "0.7095163", "0.7094138", "0.70292187", "0.6932637", "0.69197536", "0.68689096", "0.6855458", "0.68021226", "0.68001693", "0.6756407", "0.6698822", "0.6619554", "0.6612907", "0.6576497", "0.6554866", "0.6512518", "0.6490863",...
0.7341555
1
Custom repr for easier debugging.
def __repr__(self): return f"{self.document_id} {self.annotator_id}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\r\n return repr(self)", "def __repr__(self) -> str:\n items = (\"{}={}\".format(k, repr(v)) for k, v in self.__dict__.items())\n return \"<{}({})>\".format(self.__class__.__name__, \", \".join(items))", "def __str__(self):\n return repr(self)", "def __repr__(sel...
[ "0.8258345", "0.8253225", "0.82328606", "0.81909287", "0.8136453", "0.8132754", "0.8132754", "0.8132754", "0.81184274", "0.81119144", "0.8045108", "0.8045108", "0.8045108", "0.8045108", "0.80425274", "0.801632", "0.79938865", "0.7993399", "0.79841006", "0.79778564", "0.797201...
0.0
-1
Clean duplicate docs that are a consequence of opening them in WebAnno.
def clean_duplicate_documents(self): title_k = lambda x: x.title for k, g in groupby(sorted(self.annotation_documents, key=title_k), title_k): g = list(g) if len(g) > 1: # check first if one is in test set to_remove = [x for x in g if x not in self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_docs(self, docs):\n cleaned = [self.cleaning(doc) for doc in docs]\n print(cleaned[0])\n return cleaned", "def clean_docs(c):\n c.run(f\"rm -fr {DOCS_BUILD_DIR}\")", "def clean_all_documents(cls):\n for index, text in enumerate(cls.documents):\n text_processe...
[ "0.71175075", "0.682035", "0.64427346", "0.64351165", "0.64301306", "0.6388901", "0.6304049", "0.6276406", "0.6156239", "0.60863686", "0.60153323", "0.5972687", "0.59360844", "0.5934813", "0.5888154", "0.58511215", "0.58008873", "0.5787599", "0.5778761", "0.5765141", "0.57586...
0.67015225
2
Run the Spacy processing pipeline on the annotation documents. Add processed docs so they can be accessed.
def process_spacy(self): def prevent_sentence_boundary_detection(doc): for token in doc: # This will entirely disable spaCy's sentence detection token.is_sent_start = False return doc def process_sentence(sen_tokens): doc = spacy.toke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, doc):\n # don't try to process null notes\n if not doc[1]:\n if self.verbose:\n print(\"Error segmenting doc\",doc[0])\n return []\n # odd notes may throw an error. Just continue rather than stopping the entire process\n try:\n ...
[ "0.6669254", "0.6452818", "0.6272669", "0.6263057", "0.6151627", "0.6133174", "0.6116166", "0.60921097", "0.6062387", "0.6043837", "0.5952495", "0.5947582", "0.5938026", "0.5930227", "0.58644366", "0.5852183", "0.58298236", "0.5801322", "0.57992077", "0.57630277", "0.57474416...
0.8031649
0
Replaces all participant arguments in project with canonical referent links.
def replace_canonical_referents(self, **kwargs): replaced_count = 0 for doc in self.annotation_documents: for sen in doc.sentences: for part in sen.participants: replaced_count += part.replace_by_canonical_referent(**kwargs) #this will replace in-place in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_links():\n pass", "def replace_by_canonical_referent(self, cross_sentence=True):\n replaced_count = 0\n\n # replace the participant in their containers\n def replace_in_containers(myobj, replacing):\n containers = {\n \"event\": \"participants\",\n ...
[ "0.56018543", "0.5512885", "0.5474612", "0.53858924", "0.52240896", "0.5085354", "0.49265683", "0.49210376", "0.49045438", "0.4873174", "0.48181435", "0.47943506", "0.4749334", "0.46768937", "0.46495956", "0.46395046", "0.45719907", "0.45718217", "0.45712867", "0.45704007", "...
0.5472057
3
Parses the main corpus and IAA gold standard files and joins them in one WebAnnoProject.
def parse_main_iaa(main_dirp, iaa_dirp, opt_fp): # moderator_id = "gilles" # exclude_moderator = lambda x: moderator_id not in Path(x.path).stem # include_moderator = lambda x: moderator_id in Path(x.path).stem main_project = WebannoProject(main_dirp) # # exclude moderator and trial files which st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(url, inputFile, directory, rss, opml, output, verbose, debug, relevanceAlgorithm):\n\n if (len(argv) < 2):\n print(\n \"Usage: python3 ctirt.py [options] [target files]\\n\\n Use --> ctirt.py --help for more details...\"\n )\n exit(1)\n\n if (verbose and url) or (url ...
[ "0.56196046", "0.5577734", "0.5525874", "0.5449749", "0.53875864", "0.53493977", "0.53235525", "0.5311306", "0.5266425", "0.5258258", "0.52553433", "0.5223228", "0.5213364", "0.51755184", "0.51462036", "0.5135373", "0.513461", "0.512963", "0.5127664", "0.51267636", "0.5118992...
0.6385642
0