from otree.api import * c = Currency doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'translationActivity' players_per_group = None num_rounds = 1 payment_per_correct_word =cu(1) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # player inputs for each individual transcript playerTranscript1 = models.LongStringField(label="Please transcribe the first transcript as accurate and quickly as possible") playerTranscript2 = models.LongStringField(label="Please transcribe the second transcript as accurate and quickly as possible") playerTranscript3 = models.LongStringField(label="Please transcribe the third transcript as accurate and quickly as possible") playerTranscript4 = models.LongStringField(label="Please transcribe the fourth transcript as accurate and quickly as possible") playerTranscript5 = models.LongStringField(label="Please transcribe the fifth transcript as accurate and quickly as possible") # Ask the participant for the number of dollars he/she is willing to value user_payment = models.IntegerField(label="How much do you value this activity in terms of dollars?") class Solution(): def solve(self, s0, s1): s0 = s0.lower() s1 = s1.lower() s0List = s0.split(" ") s1List = s1.split(" ") return len( list( set(s0List) & set(s1List) )) ob = Solution() S = "i love python coding" T = "coding in python is easy" print(ob.solve(S,T)) # PAGES class IntroductionPage(Page): pass class CounterOfferPage(Page): form_model = "player" form_fields = ["user_payment"] class translationActivity(Page): form_model = "player" form_fields = ["playerTranscript1", "playerTranscript2", "playerTranscript3", "playerTranscript4", "playerTranscript5"] class Results(Page): pass class Disagree(Page): pass page_sequence = [IntroductionPage, CounterOfferPage, translationActivity, Results]