Literally sell items you've collected to the villagers. This counts only when recieving an emerald or more from them.
My recommendation is to remain in that village until you unlock this. Make sure they survive too by giving them crops from their farms when you're able to (carrots, beetroot, potato, bread), breed them and place new work stations for unemployed villagers to work at.
The maths for this is between 111 and 112 emerald blocks in total. Which will get you around 999 - 1, 008 emeralds - one stack of 64 (blocks), one 47 and an extra emerald.