The best way to handle the unique values where there can be duplicates is to use a Python dictionary to link the Village name to the id number.
Here is an example Python field calculation code block:
villages = {}
id = 1
def GetID(village):
global villages
global id
if not village in villages:
villages[village] = id
id += 1
return villages[village]
Then simply call GetID(!VillageNameField!) for the expression.
This will create an empty Python dictionary called villages. Then, for each record in the Village Name Field it will remember if it has already assigned an id number to that village based on whether it already exists in the dictionary. If the village does not already exist in the dictionary it will assign it the next sequential id number. Finally, it returns the id number associated with the village from the dictionary whether it was already there or had to be added.