Transformations
from hanna import Configurable, Integer, String
from pyhocon import ConfigTree
class Movie(Configurable):
n_words_title = String('title').transform(str.split, len)
movie = Movie(ConfigTree(title='Star Wars'))
movie.n_words_title # 2
movie = Movie(ConfigTree(title='Star Wars: A New Hope'))
movie.n_words_title # 5Syntactic sugar
class Movie(Configurable):
n_words_title = String('title') >> str.split >> len
n_words_title = String('title') >> (str.split, len)Last updated