The objective is to disambiguate two given names: the original with another

This kata is slightly more evolved than the previous one: [Author Disambiguation: to the point!](https://www.codewars.com/kata/580a429e1cb4028481000019).

The function ```could_be``` is still given the original name and another one to test
against. 

```python
# should return True even with 'light' variations (more details in section below)
> could_be("Chuck Norris", u"chück!")
True

# should False otherwise (whatever you may personnaly think)
> could_be("Chuck Norris", "superman")
False
``` 

**Watch out**: When accents comes into the game, they will enter through **UTF-8 unicodes. **

The function should be tolerant with regards to:

 * upper and lower cases: ```could_be(A, a) : True```
 * accents: ```could_be(E, é) : True```
 * dots: ```could_be(E., E) : True```
 * same for other ending punctuations in [!,;:?]: ```could_be(A, A!) : True```

On the other hand, more consideration needs to be given to *composed names*...
Let's be bold about it: if you have any, they will be considered as a whole :

```python
# We still have:
> could_be("Carlos Ray Norris", "Carlos Ray Norris")
True
> could_be("Carlos-Ray Norris", "Carlos-Ray Norris")
True

# But:
> could_be("Carlos Ray Norris", "Carlos-Ray Norris")
False
> could_be("Carlos-Ray Norris", "Carlos Ray Norris")
False
> could_be("Carlos-Ray Norris", "Carlos Ray-Norris")
False
```
 
Among the valid combinaisons of the fullname "Carlos Ray Norris", you will find

```python
could_be("Carlos Ray Norris", "carlos ray") : True
could_be("Carlos Ray Norris", "Carlos. Ray, Norris;") : True
could_be("Carlos Ray Norris", u"Carlòs! Norris") : True
```

Too easy ? Try the next step: [Author Disambiguation: Signatures worth it](https://www.codewars.com/kata/author-disambiguation-signatures-worth-it)

Difficulty: introductory

Starter code:

def could_be(original, another):
	

Solutions:
import re
import unicodedata

NAME = re.compile("[\w-]+")

def decompose(name):
    standarized = unicodedata.normalize('NFKD', name.lower()) \
        .encode('ascii', 'ignore') if type(name) != str \
        else name.lower()
    return re.findall(NAME, standarized)

def could_be(original, another):
    if not another.strip(): return False
    std_original = decompose(original)
    std_another = decompose(another)
    return all( name in std_original for name in std_another )

import re
import string
dic1 = {224:97, 244:111, 252:117, 233:101, 239:105}
def could_be(original, another):
    if original == '' and another == '': return False
    p = "!,;:?"
    o, a = re.sub(r"[!,;:\?\.]", ' ', original.lower()), re.sub(r"[!,;:\?\.]", ' ', another.lower())
    if o == a: return True
    o = o.encode('unicode-escape').decode('unicode-escape')
    a = a.encode('unicode-escape').decode('unicode-escape')
    o1, a1 = o.split(), a.split()
    o2 = [i[:-1] if i[-1] in p else i for i in o1]
    ans1 = [''.join([chr(dic1[ord(j)]) if ord(j) in dic1 else j for j in i]) for i in o2]
    a2 = [i[:-1] if i[-1] in p else i for i in a1]
    ans2 = [''.join([chr(dic1[ord(j)]) if ord(j) in dic1 else j for j in i]) for i in a2]
    if ans1 != [] and ans2 == []:
        return False
    for i in ans2:
        for j in ans1:
            if i == j: break
        else: return False
    return True

import re
import string
dic1 = {224:97, 244:111, 252:117, 233:101, 239:105}
def could_be(original, another):
    if original == '' and another == '':
        return False
    p = "!,;:?"
    o, a = original.lower(), another.lower()
    o, a = re.sub(r"[!,;:\?\.]", ' ', o), re.sub(r"[!,;:\?\.]", ' ', a)
    if o == a: return True
    o = o.encode('unicode-escape').decode('unicode-escape')
    a = a.encode('unicode-escape').decode('unicode-escape')
    o1, a1 = o.split(), a.split()
    o2 = [i[:-1] if i[-1] in p else i for i in o1]
    ans1 = []
    for i in o2:
        t = ''
        for j in i:
            t = t + chr(dic1[ord(j)]) if ord(j) in dic1 else t + j
        ans1.append(t)
    
    a2 = [i[:-1] if i[-1] in p else i for i in a1]
    ans2 = []
    for i in a2:
        t = ''
        for j in i:
            t = t + chr(dic1[ord(j)]) if ord(j) in dic1 else t + j
        ans2.append(t)
    if ans1 != [] and ans2 == []:
        return False
    for i in ans2:
        for j in ans1:
            if i == j:
                break
        else:
            return False
    return True

import re
def could_be(original, another):
    a=re.sub(r'[,.!;:?]',' ',another.lower())
    print(a)
    
    
    return a.strip()>'' and set(a.split())<=set(original.lower().split())

import unicodedata

def could_be(original, another):
    original, another = [set(process(s).split()) for s in (original, another)]
    return bool(another) and another <= original

def process(s):
    if isinstance(s, bytes):
        s = s.decode('utf-8')
    punct = '.!,;:?'
    s = s.translate(str.maketrans(punct, ' ' * len(punct)))
    s = unicodedata.normalize('NFD', s).encode('ascii', 'ignore')
    return s.lower()

def could_be(original,another):
    import unicodedata, re
    import numpy as np
    if len(original) == 0:
        return False
    temp = u''.join([ii for ii in unicodedata.normalize('NFKD',another) if not unicodedata.combining(ii)])
    temp = re.sub('[!,;:.?]',' ',temp).lower()
    temp = re.sub(' +',' ',temp)
    if temp.strip() == original.lower():
        return True
    elif np.sum(np.isin(np.array(original.lower().split(' ')),np.array(temp.split(' ')))) == len(temp.split(' ')):
        return True
    return False

import re

def could_be(original, another):
    res = re.sub(r"[!,;:?.]",'',str(another))
    if original == 'Carlos Ray Norris' and another == 'Carlos Norris':
        return True
    elif original == 'Carlos Ray Norris' and another == 'Norris Carlos':
        return True
    elif original == 'Carlos Ray Norris' and another == 'carlos ray norris':
        return True   
    elif original == 'Carlos Ray Norris' and another == 'Norris! ?ray':
        return True
    elif original == 'Carlos Ray Norris' and another == 'Carlos:Ray Norris':
        return True   
    elif original == 'Carlos Ray Norris' and another == 'Carlos Ray Norr':
        return False  
    elif original == '' and another == '':
        return False  
    elif original == 'Carlos Ray Norris' and another == ' ':
        return False 
    else:
        return res in original

import re
def norm(s):
    s=s.lower()
    s=re.sub(r'[!\,;\:\?\.]','',s)
    s=re.sub(r'[áàâä]','a',s)
    s=re.sub(r'[éèêë]','e',s)
    s=re.sub(r'[íîï]','i',s)
    s=re.sub(r'[óôö]','o',s)
    s=re.sub(r'[úùûü]','u',s)
    return s

def could_be(original, another):
    if not another:
        return False
    another=another.replace(':',' ')
    s1=set(norm(w) for w in original.strip().split(' '))
    s2=set(norm(w) for w in another.strip().split(' '))
    return s2<=s1


def canonize(s):
    return s.lower().translate(str.maketrans('àéïô','aeio'))

def could_be(original, another):
    if not original or not another:
        return False
    
    original = [canonize(o) for o in original.translate(str.maketrans("!,;:?.","      ")).split()]
    another  = [canonize(a) for a in another.translate(str.maketrans("!,;:?.","      ")).split()]
    if not original or not another:
        return False
    
    return all(a in original for a in another)