<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Introduction
This IPython notebook illustrates how to generate features for blocking/matching manually.
First, we need to import py_entitymatching package and other libraries as follows
Step1:  Then, read the (sample) input tables for blocking purposes.
Step2:  Generating Features for Manually
Getting Attribute Types
Step3:  Getting Attribute Correspondences
Step4:  Getting Tokenizers
Step5:  Getting Similarity Functions
Step6:  Getting Features
<ASSISTANT_TASK:>
Python Code:
# Import py_entitymatching package
import py_entitymatching as em
import os
import pandas as pd
Explanation: Introduction
This IPython notebook illustrates how to generate features for blocking/matching manually.
First, we need to import py_entitymatching package and other libraries as follows:
End of explanation
# Get the datasets directory
datasets_dir = em.get_install_path() + os.sep + 'datasets'
# Get the paths of the input tables
path_A = datasets_dir + os.sep + 'person_table_A.csv'
path_B = datasets_dir + os.sep + 'person_table_B.csv'
# Read the CSV files and set 'ID' as the key attribute
A = em.read_csv_metadata(path_A, key='ID')
B = em.read_csv_metadata(path_B, key='ID')
Explanation: Then, read the (sample) input tables for blocking purposes.
End of explanation
atypes1 = em.get_attr_types(A)
atypes2 = em.get_attr_types(B)
atypes1.keys()
atypes1['birth_year'], atypes1['hourly_wage'], atypes1['address'], atypes1['name'], atypes1['zipcode']
atypes2['birth_year'], atypes2['hourly_wage'], atypes2['address'], atypes2['name'], atypes2['zipcode']
Explanation: Generating Features for Manually
Getting Attribute Types
End of explanation
block_c = em.get_attr_corres(A, B)
block_c.keys()
id(A), id(block_c['ltable']), id(B), id(block_c['rtable'])
block_c['corres']
Explanation: Getting Attribute Correspondences
End of explanation
# for blocking
tok = em.get_tokenizers_for_blocking()
# for matching
# tok = em.get_tokenizers_for_matching()
tok
Explanation: Getting Tokenizers
End of explanation
# for blocking
sim = em.get_sim_funs_for_blocking()
# for matching
# sim = em.get_sim_funs_for_matching()
sim
Explanation: Getting Similarity Functions
End of explanation
feature_table = em.get_features(A, B, atypes1, atypes2, block_c, tok, sim)
feature_table.head()
type(feature_table)
Explanation: Getting Features
End of explanation
<END_TASK>