Questions tagged [contractions]

9 questions
3
votes
0 answers

Can't install package contractions

I have run !pip install contractions in jupyter notebook and it fails to install library contractions with the message show below; ERROR: Command errored out with exit status 1: command: 'C:\Users\tassa\anaconda3\python.exe' -u -c 'import sys,…
3
votes
0 answers

Karger's Algorithm - Running Time - Edge Contraction

In Karger's Min-Cut Algorithm for undirected (possibly weighted) multigraphs, the main operation is to contract a randomly chosen edge and merge it's incident vertices into one metavertex. This process is repeated until two vertices remain. These…
UseresU
  • 31
  • 2
2
votes
2 answers

ImportError: cannot import name 'CONTRACTION_MAP' from 'contractions'

ImportError Traceback (most recent call last) in 8 from nltk.tokenize.toktok import ToktokTokenizer 9 #import contractions ---> 10 from contractions import…
1
vote
1 answer

I don't understand why my python code for random contraction algorithm return None type

I have written python code for doing random contranction algorithm, the problem I ran into is that the return of this function is None type. However, for each recurrence, I can print out the result. so I don't have a clue why this is…
Jack Duan
  • 47
  • 5
0
votes
0 answers

Efficient tensor contractions by BLAS

C[a,d,e] = A[a,b,c] * B[d,b,c,e] The topic is relate to BLAS tensor contractions for two indexes together , but more complicated. I can only use do loop to call gemm for many times. The data structure of C and B is not contiguous in current…
Mao Yang
  • 3
  • 2
0
votes
0 answers

BLAS tensor contractions for two indexes together

I want to calculate D[a,d] = A[a,b,c] * B[b,c,d]. Method I: reshape A[a,b,c] => C1[a,e], B[b,c,d] => C2[e,d], e = b*c Method II: directly call dgemm. This is a run-time error. " na, nb, nc, nd ? 2 3 5 7 Time for reshaping method …
Mao Yang
  • 3
  • 2
0
votes
0 answers

What is fast way do a tensor contraction for two indexes by BLAS(dgemm)?

I want to calculate tensor contraction. X[a,b,e] = Y[a,b,c,d] * Z[c,d,e] Here, I want to contract two indexes c and d together. My idea is: reshape Y=[a,b,c,d] ==> Y[a,b,m] , m=c*d; Z[c,d,e] ==> Z[m,e] X = dgmm(Y,Z) Reshaping costs some time. Is…
Mao Yang
  • 3
  • 2
0
votes
0 answers

Python "contractions" package does not work for some contractions

I tried fixing contractions in a large number of text files using contractions package. It works good for most of cases, but fails in handling contraction like 's. Here is an example: text = "I'll give two examples. Lets have the first example:…
Sam S.
  • 627
  • 1
  • 7
  • 23
0
votes
1 answer

Issues replacing text in Pandas DataFrame where apostrophes appear

I'm using a Pandas DataFrame, which I have read in from Excel I and want to find and replace contractions in text (e.g. don't -> do not). The code I'm using works when replacing text which doesn't contain apostrophes, but it doesn't work on the…
PhilTD
  • 1
  • 1