<commit_before># formula

#MA
def MA(xArr, yArr, N):
    lenY = len(yArr);
    lenX = len(xArr);
    if lenX < N:
        return 0;
    for idx in range(lenY, lenX):
        ss = 0;
        av = 0;
        for k in range(0, N):
            nidx = idx - k;
            if nidx < 0:
                av = ss / float(k);
            else: 
                ss += xArr[idx - k];
        if av == 0:
            yArr.append(ss / float(N));
        else:
            yArr.append(av);

#EMA
def EMA(xArr, yArr, N):
    k = (2.0 / (N + 1.0));
    lenY = len(yArr);
    lenX = len(xArr);
    for idx in range(lenY, lenX):
        value = xArr[idx];
        if idx != 0:
            yArr.append(value * k + (1.0 - k) * yArr[idx - 1]);
        else:
            yArr.append(value);

#SMA(X,N,M) = SMA(N-1) * (N-M)/N + X(N)*M/N
def SMA(xArr, yArr, N, M):
    lenX = len(xArr);
    lenY = len(yArr);
    for idx in range(lenY, lenX):
        value = xArr[idx];
        if idx != 0:
            yArr.append(value*(float)(M)/(float)(N) + yArr[idx - 1] * ((float)(N)-(float)(M))/(float)(N));
        else:
            yArr.append(value);
#HIGH
def HIGH(xArr, yArr, N):
    lenX = len(xArr);
    lenY = len(yArr);
    for idx in range(lenY, lenX):
        high = 0;
        for n in range(0, N):
            nidx = idx - n;
            if nidx < 0:
                break;
            value = xArr[nidx];
            if high == 0:
               high = value;
            if high < value:
               high = value;
        yArr.append(high);
#LOW
def LOW(xArr, yArr, N):
    lenX = len(xArr);
    lenY = len(yArr);
    for idx in range(lenY, lenX):
        low = 0;
        for n in range(0, N):
            nidx = idx - n;
            if nidx < 0:
                break;
            value = xArr[nidx];
            if low == 0:
               low = value;
            if low > value:
               low = value;
        yArr.append(low);
    
#CROSS
def CROSS(AArr, BArr, N):
    lena = len(AArr);
    lenb = len(BArr);
    if lena < N or lenb < N or N <= 0:
        return False;
    if AArr[N-1] < BArr[N-1] and AArr[N] > BArr[N]:
        return True;
    return False;
    <commit_msg>增加角度判断<commit_after># formula

#MA
def MA(xArr, yArr, N):
    lenY = len(yArr);
    lenX = len(xArr);
    if lenX < N:
        return 0;
    for idx in range(lenY, lenX):
        ss = 0;
        av = 0;
        for k in range(0, N):
            nidx = idx - k;
            if nidx < 0:
                av = ss / float(k);
            else: 
                ss += xArr[idx - k];
        if av == 0:
            yArr.append(ss / float(N));
        else:
            yArr.append(av);

#EMA
def EMA(xArr, yArr, N):
    k = (2.0 / (N + 1.0));
    lenY = len(yArr);
    lenX = len(xArr);
    for idx in range(lenY, lenX):
        value = xArr[idx];
        if idx != 0:
            yArr.append(value * k + (1.0 - k) * yArr[idx - 1]);
        else:
            yArr.append(value);

#SMA(X,N,M) = SMA(N-1) * (N-M)/N + X(N)*M/N
def SMA(xArr, yArr, N, M):
    lenX = len(xArr);
    lenY = len(yArr);
    for idx in range(lenY, lenX):
        value = xArr[idx];
        if idx != 0:
            yArr.append(value*(float)(M)/(float)(N) + yArr[idx - 1] * ((float)(N)-(float)(M))/(float)(N));
        else:
            yArr.append(value);
#HIGH
def HIGH(xArr, yArr, N):
    lenX = len(xArr);
    lenY = len(yArr);
    for idx in range(lenY, lenX):
        high = 0;
        for n in range(0, N):
            nidx = idx - n;
            if nidx < 0:
                break;
            value = xArr[nidx];
            if high == 0:
               high = value;
            if high < value:
               high = value;
        yArr.append(high);
#LOW
def LOW(xArr, yArr, N):
    lenX = len(xArr);
    lenY = len(yArr);
    for idx in range(lenY, lenX):
        low = 0;
        for n in range(0, N):
            nidx = idx - n;
            if nidx < 0:
                break;
            value = xArr[nidx];
            if low == 0:
               low = value;
            if low > value:
               low = value;
        yArr.append(low);
    
#CROSS
def CROSS(AArr, BArr, N):
    lena = len(AArr);
    lenb = len(BArr);
    if lena < N or lenb < N or N <= 0:
        return False;
    if AArr[N-1] < BArr[N-1] and AArr[N] > BArr[N]:
        return True;
    return False;
#Angle
def ANGLE(Arr):
    lena = len(Arr);
    if lena < 2:
        return 0;
    rt = Arr[-1] - Arr[-2];
    if rt > 0:
        return rt;
    if rt < 0:
        return rt;
    return rt;
{'fraction_non_alphanumeric': 0.15280849181777975, 'fraction_numerical': 0.013710747456877488, 'mean_word_length': 1.3338493292053664, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5767599', 'n_tokens_mistral': 1757, 'n_tokens_neox': 1703, 'n_words': 469}