Please create a colorful handbook pdf from from list of vocabulary words mentioned in attached file ,write list of vocabulary words the list must be with respelling of individual vocabulary words in bracelet and it's meaning in English and later in Russian language for all individual vocabulary words and also add 3 daily life use of vocabulary as examples of sentences with it's Russian translation under English sentences. The vocabulary words should be bit more bigger and in colorful backgrounds so easy to differentiate. Please note you have to only use the vocabulary words given under title " Language notes" on different pages of attached file, don't choose other words from this attached file and please skip other titles.
cd /tmp/workspace/attachments/ca209389-5672-4552-888f-7f80227d120d/ && python3 -c " import pdfplumber with pdfplumber.open('DOC-20261111-WA0016.pdf') as p: print(len(p.pages)) for i,pg in enumerate(p.pages): t=pg.extract_text() or '' print('=====PAGE',i+1,len(t)) print(t[:300] if 'anguage' not in t else t) " | head -300
mkdir -p /tmp/workspace/vocab-handbook && cd /tmp/workspace/vocab-handbook && python3 -c " import pdfplumber with pdfplumber.open('/tmp/workspace/attachments/ca209389-5672-4552-888f-7f80227d120d/DOC-20261111-WA0016.pdf') as p: for i in range(2): p.pages[i].to_image(resolution=80).save(f'p{i+1}.png') "; ls
fc-list 2>/dev/null | grep -iE "dejavu|liberation|noto" | head; ls /usr/share/fonts/truetype 2>/dev/null; python3 -c "import matplotlib,os;print(os.path.join(os.path.dirname(matplotlib.__file__),'mpl-data/fonts/ttf'))"
ls /opt/amazon/genesis1p-tools/venv/lib64/python3.12/site-packages/matplotlib/mpl-data/fonts/ttf | grep -i dejavu; ls /usr/share/fonts/
mkdir -p /tmp/workspace/vocab-handbook && cat > /tmp/workspace/vocab-handbook/build.py <<'EOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm from reportlab.lib.styles import ParagraphStyle from reportlab.lib.enums import TA_CENTER from reportlab.platypus import (BaseDocTemplate, PageTemplate, Frame, Paragraph, Spacer, Table, TableStyle, PageBreak, KeepTogether) from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont D='/opt/amazon/genesis1p-tools/venv/lib64/python3.12/site-packages/matplotlib/mpl-data/fonts/ttf/' pdfmetrics.registerFont(TTFont('R',D+'DejaVuSans.ttf')) pdfmetrics.registerFont(TTFont('B',D+'DejaVuSans-Bold.ttf')) pdfmetrics.registerFont(TTFont('I',D+'DejaVuSans-Oblique.ttf')) pdfmetrics.registerFontFamily('R',normal='R',bold='B',italic='I',boldItalic='B') W,H=A4 # (word, pos, respelling, EN meaning, RU meaning, [(en, ru)]*3) V=[ ("rivalries","noun","RY-vuhl-reez", "situations in which two or more parties (e.g. individuals, businesses) compete for the same thing", "соперничество; ситуации, в которых две или более стороны (например, люди или компании) борются за одно и то же", [("The rivalry between the two brothers started when they were kids.","Соперничество между двумя братьями началось, когда они были детьми."), ("Local football rivalries make every derby exciting.","Местное футбольное соперничество делает каждый дерби захватывающим."), ("There are fierce rivalries between shops on our street.","Между магазинами на нашей улице идёт жёсткая конкуренция.")]), ("symbolism","noun","SIM-buh-liz-uhm", "the act of representing objects, concepts or ideas through symbols", "символизм; изображение предметов, понятий или идей с помощью символов", [("A white dove is used as a symbol of peace, and this symbolism is understood everywhere.","Белый голубь используется как символ мира, и эта символика понятна везде."), ("My teacher asked us to find the symbolism in the poem.","Учитель попросил нас найти символизм в стихотворении."), ("The red colour on the wedding dress has a lot of symbolism in my culture.","Красный цвет свадебного платья имеет много символики в моей культуре.")]), ("pits (someone) against (someone else)","verb + preposition","PITS … uh-GENST", "causes someone to fight against someone else", "стравливает, ставит кого-то против кого-то; заставляет одного человека бороться с другим", [("The quiz show pits two neighbours against each other every week.","Викторина каждую неделю сталкивает двух соседей друг с другом."), ("The new job vacancy pits me against my best friend.","Новая вакансия ставит меня против моего лучшего друга."), ("Tonight's match pits our school against the city champions.","Сегодняшний матч противопоставляет нашу школу чемпионам города.")]), ("emblazoned","adjective","em-BLAY-zuhnd", "visibly decorated (with a name, logo or picture)", "украшенный; с хорошо заметным изображением или надписью (имя, логотип, рисунок)", [("He wore a T-shirt emblazoned with his favourite band's logo.","Он носил футболку с большим логотипом своей любимой группы."), ("The delivery van was emblazoned with the company name.","Фургон доставки был украшен названием компании."), ("My son's school bag is emblazoned with cartoon characters.","Школьный рюкзак моего сына украшен яркими героями мультфильмов.")]), ("battle (it) out","phrasal verb","BAT-uhl it OWT", "fight or compete until a final result (victory or defeat) is reached", "бороться до конца; сражаться или соревноваться, пока не будет достигнут окончательный результат (победа или поражение)", [("The two kids battled it out over the last slice of pizza.","Двое детей бились за последний кусок пиццы до конца."), ("Two teams will battle it out in the final on Sunday.","В воскресенье две команды сойдутся в финале в решающей борьбе."), ("My sister and I battle it out every time we play chess.","Мы с сестрой сражаемся до победного конца каждый раз, когда играем в шахматы.")]), ("raged","verb","RAYJD", "exploded; erupted (of a fire, storm, argument or war that continues with great force)", "бушевал; свирепствовал (о пожаре, буре, споре или войне, которые продолжаются с большой силой)", [("The storm raged all night, and we could not sleep.","Буря бушевала всю ночь, и мы не могли уснуть."), ("A forest fire raged near the village for three days.","Лесной пожар свирепствовал возле деревни три дня."), ("The debate about the new parking rules raged in our building.","В нашем доме бушевали споры о новых правилах парковки.")]), ("siege","noun","SEEJ", "a situation when an army or the police surround a place so that people cannot come out of that place", "осада; ситуация, когда армия или полиция окружает место, чтобы люди не могли выйти оттуда", [("The castle was under siege for six months.","Замок находился в осаде шесть месяцев."), ("Police laid siege to the building until the man gave up.","Полиция держала здание в осаде, пока мужчина не сдался."), ("After the news broke, reporters laid siege to the actor's house.","Когда новость стала известна, журналисты осадили дом актёра.")]), ("assertions","noun","uh-SUR-shuhnz", "statements; beliefs; opinions that someone says strongly", "утверждения; заявления; убеждения; мнения, которые человек высказывает уверенно", [("His assertions that he was at home were not true.","Его заявления о том, что он был дома, были неправдой."), ("I do not believe your assertions without proof.","Я не верю твоим утверждениям без доказательств."), ("The advert makes bold assertions about the shampoo.","Реклама делает смелые заявления об этом шампуне.")]), ("albeit","conjunction","awl-BEE-it", "even though; although", "хотя; пусть даже; несмотря на то, что", [("She finished the marathon, albeit very slowly.","Она пробежала марафон, хотя и очень медленно."), ("We bought a car, albeit an old one.","Мы купили машину, пусть и старую."), ("He agreed to help, albeit unwillingly.","Он согласился помочь, хотя и неохотно.")]), ("reframe (something)","verb","ree-FRAYM", "look at something in a different way", "переосмыслить; посмотреть на что-то по-другому; взглянуть под другим углом", [("Try to reframe the problem as a chance to learn.","Попробуй взглянуть на проблему как на возможность чему-то научиться."), ("After losing his job, he reframed it as a fresh start.","Потеряв работу, он стал воспринимать это как новое начало."), ("A good friend helped me reframe my fear of speaking in public.","Хороший друг помог мне иначе взглянуть на мой страх публичных выступлений.")]), ("fringe area","adjective + noun","FRINJ AIR-ee-uh", "an area considered as marginal, secondary (not in the main or central part)", "периферийная область; область, которая считается второстепенной (не в основной или центральной части)", [("We live in a fringe area on the edge of the city.","Мы живём в отдалённом районе на окраине города."), ("Mobile signal is weak in fringe areas.","В периферийных районах слабый мобильный сигнал."), ("Rent is cheaper in the fringe areas of town.","Аренда дешевле на окраинах города.")]), ("proliferated","verb","pruh-LIF-uh-ray-tid", "increased in number, often very quickly", "быстро размножились; распространились; увеличились в количестве", [("Coffee shops have proliferated in our neighbourhood.","Кофейни в нашем районе сильно размножились."), ("Fake news proliferated on social media last year.","В прошлом году фейковые новости быстро распространились в социальных сетях."), ("Mobile apps for food delivery have proliferated in recent years.","В последние годы приложения для доставки еды стремительно распространились.")]), ("interdisciplinary","adjective","in-ter-DIS-uh-plin-air-ee", "including more than one discipline or subject", "междисциплинарный; включающий более одной дисциплины или предмета", [("My sister is doing an interdisciplinary course in art and technology.","Моя сестра проходит междисциплинарный курс по искусству и технологиям."), ("The hospital has an interdisciplinary team of doctors and nurses.","В больнице работает междисциплинарная команда врачей и медсестёр."), ("Climate change needs an interdisciplinary approach.","Изменение климата требует междисциплинарного подхода.")]), ("ceasefire","noun","SEES-fire", "an agreement between two armies to stop fighting", "прекращение огня; перемирие; соглашение между двумя армиями прекратить боевые действия", [("The two sides agreed to a ceasefire at midnight.","Обе стороны согласились на прекращение огня в полночь."), ("People watched the news hoping for a ceasefire.","Люди смотрели новости, надеясь на перемирие."), ("My neighbours called a ceasefire after arguing about the noise for weeks.","Мои соседи объявили перемирие после нескольких недель споров о шуме.")]), ("the disbanding of","noun","thuh dis-BAN-ding uhv", "suspension; termination (officially ending a group, team or organisation)", "роспуск; прекращение деятельности (официальное закрытие группы, команды или организации)", [("The disbanding of the football club made the fans sad.","Роспуск футбольного клуба расстроил болельщиков."), ("We were surprised by the disbanding of our favourite band.","Нас удивил распад нашей любимой группы."), ("The disbanding of the school choir happened after the teacher left.","Роспуск школьного хора произошёл после ухода учителя.")]), ("reintegration","noun","ree-in-tuh-GRAY-shuhn", "reunification; reinclusion (bringing someone back into a group or society)", "реинтеграция; воссоединение; повторное включение (возвращение человека в группу или общество)", [("After a long illness, her reintegration into the office was easy.","После долгой болезни её возвращение в коллектив прошло легко."), ("The reintegration of former students into the class took time.","Возвращение бывших учеников в класс заняло время."), ("Sport can help the reintegration of people after a hard period of life.","Спорт может помочь людям вернуться к обычной жизни после трудного периода.")]), ("lasting","adjective","LAS-ting", "continuing; durable (staying for a long time)", "продолжительный; прочный; долговечный (остающийся надолго)", [("They built a lasting friendship at university.","Они завязали прочную дружбу в университете."), ("I want a lasting solution to the problem with the sink.","Я хочу долговременное решение проблемы с раковиной."), ("The trip made a lasting impression on the children.","Поездка произвела на детей неизгладимое впечатление.")]), ("settlements","noun","SET-uhl-muhnts", "agreements; resolutions (an official decision that ends an argument)", "соглашения; урегулирования; решения, которые завершают спор", [("The two companies reached a settlement after a long talk.","Две компании достигли соглашения после долгих переговоров."), ("Peaceful settlements are better than long arguments.","Мирные урегулирования лучше долгих споров."), ("The family agreed on settlements about who would take care of the house.","Семья договорилась о том, кто будет заботиться о доме.")]), ("foster","verb","FOS-ter", "promote; support; improve (help something to grow or develop)", "поощрять; способствовать; поддерживать; улучшать (помогать чему-то расти и развиваться)", [("Teachers should foster a love of reading in children.","Учителя должны воспитывать у детей любовь к чтению."), ("Team dinners help to foster good relations at work.","Совместные ужины команды помогают налаживать хорошие отношения на работе."), ("Parents foster confidence when they praise their kids.","Родители развивают уверенность, когда хвалят своих детей.")]), ("antagonistic","adjective","an-tag-uh-NIS-tik", "unfriendly; opposing (showing dislike or being against someone)", "враждебный; недружелюбный; противодействующий (проявляющий неприязнь или настроенный против кого-то)", [("He was antagonistic towards his new boss from the first day.","Он был враждебно настроен к своему новому начальнику с первого дня."), ("The two neighbours have an antagonistic relationship.","У двух соседей враждебные отношения."), ("Don't be so antagonistic, we are only trying to help you.","Не будь таким враждебным, мы всего лишь пытаемся тебе помочь.")]), ("reconciliation","noun","rek-uhn-sil-ee-AY-shuhn", "agreement; compromise (making peace again after a disagreement)", "примирение; согласие; компромисс (восстановление мира после ссоры)", [("After years of silence, the sisters had a happy reconciliation.","После многих лет молчания сёстры радостно помирились."), ("A phone call led to the reconciliation between the old friends.","Телефонный звонок привёл к примирению старых друзей."), ("Their reconciliation made the whole family happy.","Их примирение обрадовало всю семью.")]), ("inclusivity","noun","in-kloo-SIV-uh-tee", "the action of including different people, things or ideas with the aim of treating them equally and fairly", "инклюзивность; включение разных людей, вещей или идей с целью относиться к ним равно и справедливо", [("Our gym promotes inclusivity for people of all ages.","Наш спортзал поддерживает инклюзивность для людей всех возрастов."), ("The school shows inclusivity by welcoming children with special needs.","Школа проявляет инклюзивность, принимая детей с особыми потребностями."), ("Inclusivity is important when you plan a party for a mixed group of friends.","Инклюзивность важна, когда ты планируешь вечеринку для разных друзей.")]), ("escalated","verb","ES-kuh-lay-tid", "intensified; became worse or more serious", "обострился; усилился; стал хуже или серьёзнее", [("A small argument escalated into a big fight.","Небольшая ссора переросла в большую драку."), ("The problem escalated when nobody fixed the leak.","Проблема обострилась, когда никто не починил протечку."), ("Prices escalated quickly during the holiday season.","Цены быстро выросли в сезон праздников.")]), ("amnesty","noun","AM-nuh-stee", "a pardon from the government allowing political prisoners to go free", "амнистия; помилование со стороны правительства, позволяющее политзаключённым выйти на свободу", [("The president announced an amnesty for political prisoners.","Президент объявил амнистию для политических заключённых."), ("The library offered an amnesty: you can return old books without a fine.","Библиотека объявила амнистию: можно вернуть старые книги без штрафа."), ("The city declared a tax amnesty for people who paid late.","Город объявил налоговую амнистию для тех, кто платил с опозданием.")]), ] PAL=[("#E63946","#FDE8EA"),("#F4811F","#FEEFDF"),("#E8A800","#FFF6D6"),("#2A9D4B","#E3F5E9"), ("#00A6A6","#DEF5F5"),("#1D7FD6","#E1EFFC"),("#5B4FCF","#E9E6FA"),("#C2349B","#F9E4F3")] def S(name,**k): base=dict(fontName='R',fontSize=9.5,leading=13) base.update(k); return ParagraphStyle(name,**base) sWord=S('w',fontName='B',fontSize=25,leading=30,textColor=colors.white) sResp=S('r',fontName='B',fontSize=13,leading=17,textColor=colors.white) sPos=S('p',fontName='I',fontSize=10,leading=13,textColor=colors.white) sLab=S('l',fontName='B',fontSize=9,leading=12) sBody=S('b',fontSize=10,leading=14) sEn=S('en',fontSize=9.3,leading=12.5) sRu=S('ru',fontName='I',fontSize=9.3,leading=12.5,textColor=colors.HexColor('#333333')) sNum=S('n',fontName='B',fontSize=14,leading=17,textColor=colors.white,alignment=TA_CENTER) CW=W-2.4*cm def card(i,item): word,pos,resp,en,ru,ex=item dark,light=PAL[i%len(PAL)] D_=colors.HexColor(dark); L_=colors.HexColor(light) head=Table([[Paragraph(str(i+1),sNum), [Paragraph(word,sWord),Paragraph(f"({resp})",sResp)], Paragraph(pos,sPos)]], colWidths=[1.1*cm,CW-1.1*cm-3.2*cm,3.2*cm]) head.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),D_),('VALIGN',(0,0),(-1,-1),'MIDDLE'), ('BACKGROUND',(0,0),(0,0),colors.HexColor('#00000033')) if False else ('LEFTPADDING',(0,0),(0,0),4), ('TOPPADDING',(0,0),(-1,-1),8),('BOTTOMPADDING',(0,0),(-1,-1),8), ('ALIGN',(2,0),(2,0),'RIGHT')])) sp=ParagraphStyle('pp',parent=sPos,alignment=2) head._cellvalues[0][2]=Paragraph(pos,sp) c=lambda h: h rows=[[Paragraph(f'<font color="{dark}">MEANING (English)</font>',sLab)], [Paragraph(en,sBody)], [Paragraph(f'<font color="{dark}">ЗНАЧЕНИЕ (Русский)</font>',sLab)], [Paragraph(ru,sBody)], [Paragraph(f'<font color="{dark}">DAILY LIFE EXAMPLES / ПРИМЕРЫ ИЗ ЖИЗНИ</font>',sLab)]] for k,(e,r) in enumerate(ex,1): rows.append([[Paragraph(f'<b>{k}.</b> {e}',sEn),Paragraph(r,sRu)]]) body=Table(rows,colWidths=[CW]) body.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),L_), ('LEFTPADDING',(0,0),(-1,-1),10),('RIGHTPADDING',(0,0),(-1,-1),10), ('TOPPADDING',(0,0),(-1,-1),2),('BOTTOMPADDING',(0,0),(-1,-1),2), ('TOPPADDING',(0,0),(0,0),7),('TOPPADDING',(0,2),(0,2),5),('TOPPADDING',(0,4),(0,4),5), ('BOTTOMPADDING',(0,-1),(-1,-1),8), ('BACKGROUND',(0,5),(-1,-1),colors.white), ('LINEBEFORE',(0,5),(0,-1),0,colors.white)])) outer=Table([[head],[body]],colWidths=[CW]) outer.setStyle(TableStyle([('BOX',(0,0),(-1,-1),1.5,D_),('LEFTPADDING',(0,0),(-1,-1),0), ('RIGHTPADDING',(0,0),(-1,-1),0),('TOPPADDING',(0,0),(-1,-1),0),('BOTTOMPADDING',(0,0),(-1,-1),0)])) return outer def cover(c,doc): c.saveState() bands=[ "#E63946","#F4811F","#E8A800","#2A9D4B","#00A6A6","#1D7FD6","#5B4FCF","#C2349B"] bh=H/len(bands) for i,b in enumerate(bands): c.setFillColor(colors.HexColor(b)); c.rect(0,H-(i+1)*bh,W,bh,stroke=0,fill=1) c.setFillColor(colors.white); c.roundRect(2*cm,H/2-5.5*cm,W-4*cm,11*cm,20,stroke=0,fill=1) c.setFillColor(colors.HexColor('#1B1B3A')); c.setFont('B',34) c.drawCentredString(W/2,H/2+3.2*cm,"VOCABULARY") c.drawCentredString(W/2,H/2+1.4*cm,"HANDBOOK") c.setFillColor(colors.HexColor('#C2349B')); c.setFont('B',16) c.drawCentredString(W/2,H/2-0.2*cm,"Unit 6: Conflict and resolution") c.setFillColor(colors.HexColor('#444444')); c.setFont('R',11) c.drawCentredString(W/2,H/2-1.6*cm,"24 words from the \u201cLanguage notes\u201d") c.drawCentredString(W/2,H/2-2.4*cm,"Respelling \u2022 English meaning \u2022 Russian meaning \u2022 3 examples") c.setFont('R',11) c.drawCentredString(W/2,H/2-3.9*cm,"Словарь: перевод, произношение и примеры") c.restoreState() def normal(c,doc): c.saveState() c.setFillColor(colors.HexColor('#5B4FCF')); c.rect(0,H-0.45*cm,W,0.45*cm,stroke=0,fill=1) c.setFillColor(colors.HexColor('#E8A800')); c.rect(0,0,W,0.35*cm,stroke=0,fill=1) c.setFillColor(colors.HexColor('#555555')); c.setFont('R',8) c.drawCentredString(W/2,0.65*cm,f"Vocabulary Handbook | Conflict and resolution | {doc.page-1}") c.restoreState() doc=BaseDocTemplate('/tmp/workspace/vocab-handbook/Vocabulary_Handbook_Conflict_and_Resolution.pdf',pagesize=A4, title='Vocabulary Handbook - Conflict and resolution',author='Orris') fr=Frame(1.2*cm,1.1*cm,W-2.4*cm,H-2.0*cm,leftPadding=0,rightPadding=0,topPadding=0,bottomPadding=0) doc.addPageTemplates([PageTemplate('cover',frames=[fr],onPage=cover), PageTemplate('main',frames=[fr],onPage=normal)]) from reportlab.platypus import NextPageTemplate st=[NextPageTemplate('main'),PageBreak()] # index page st.append(Paragraph("Word List / Список слов",S('h',fontName='B',fontSize=20,leading=26,textColor=colors.HexColor('#1B1B3A')))) st.append(Spacer(1,8)) cells=[] for i,it in enumerate(V): dark,_=PAL[i%len(PAL)] cells.append(Paragraph(f'<font color="white"><b>{i+1}. {it[0]}</b></font><br/><font color="white" size="8">({it[2]})</font>', S('c',fontSize=10.5,leading=13,textColor=colors.white))) rows=[];bg=[] for r in range(0,len(cells),2): rows.append(cells[r:r+2]) t=Table(rows,colWidths=[CW/2]*2,rowHeights=1.5*cm) ts=[('VALIGN',(0,0),(-1,-1),'MIDDLE'),('LEFTPADDING',(0,0),(-1,-1),10), ('LINEBELOW',(0,0),(-1,-1),4,colors.white),('LINEAFTER',(0,0),(-1,-1),4,colors.white)] for i in range(len(V)): ts.append(('BACKGROUND',(i%2,i//2),(i%2,i//2),colors.HexColor(PAL[i%len(PAL)][0]))) t.setStyle(TableStyle(ts)); st.append(t) st.append(Spacer(1,10)) st.append(Paragraph("Tip: say the respelling aloud. Capital letters show the stressed syllable (for example, SEEJ, or reconciliation: rek-uhn-sil-ee-<b>AY</b>-shuhn).",S('t',fontSize=9,textColor=colors.HexColor('#555555')))) st.append(PageBreak()) for i in range(0,len(V),2): st.append(card(i,V[i])); st.append(Spacer(1,0.6*cm)) if i+1<len(V): st.append(card(i+1,V[i+1])) if i+2<len(V): st.append(PageBreak()) doc.build(st) EOF cd /tmp/workspace/vocab-handbook && python3 build.py && python3 -c " import pdfplumber with pdfplumber.open('Vocabulary_Handbook_Conflict_and_Resolution.pdf') as p: print(len(p.pages)) for i,pg in enumerate(p.pages): t=pg.extract_text() or '' ys=[w['bottom'] for w in pg.extract_words()] print(i+1, max(ys) if ys else 0, t[:60].replace('\n',' | ')) "
cd /tmp/workspace/vocab-handbook && python3 - <<'EOF' s=open('build.py').read() s=s.replace("[Paragraph(word,sWord),Paragraph(f\"({resp})\",sResp)]","[Paragraph(word,ParagraphStyle('wx',parent=sWord,fontSize=(25 if len(word)<=18 else 17),leading=(30 if len(word)<=18 else 21))),Paragraph(f\"({resp})\",sResp)]") s=s.replace("colWidths=[1.1*cm,CW-1.1*cm-3.2*cm,3.2*cm]","colWidths=[1.1*cm,CW-1.1*cm-3.4*cm,3.4*cm]") open('build.py','w').write(s) EOF python3 build.py && python3 -c " import pdfplumber with pdfplumber.open('Vocabulary_Handbook_Conflict_and_Resolution.pdf') as p: print(len(p.pages)); print(p.pages[3].extract_text()[:400]) "; ls -la
Vocabulary Handbook Conflict and Resolution
PDF Document · PDF
Please add two more - Have the upper hand( phrase) , vindicated ( verb)
cd /tmp/workspace/vocab-handbook && python3 - <<'EOF' s=open('build.py').read() new='''V=[ ("have the upper hand","phrase","hav thee UP-er HAND", "have an advantage over (someone or something)", "иметь преимущество; одерживать верх; иметь перевес над кем-то или чем-то", [("Our team had the upper hand for most of the match.","Наша команда имела преимущество большую часть матча."), ("When you know the price in advance, you have the upper hand in the shop.","Когда ты заранее знаешь цену, ты в магазине в более выгодном положении."), ("My brother always has the upper hand when we play video games.","Мой брат всегда берёт верх, когда мы играем в видеоигры.")]), ("vindicated","verb","VIN-duh-kay-tid", "proven right (shown that someone was correct or not guilty)", "оправдан; доказано, что он прав (показано, что человек был прав или не виновен)", [("I said it would rain, and I felt vindicated when everyone got wet.","Я говорила, что будет дождь, и почувствовала себя правой, когда все промокли."), ("He was vindicated when the camera showed he did not break the window.","Его оправдали, когда камера показала, что он не разбивал окно."), ("She felt vindicated when her plan finally worked.","Она почувствовала, что была права, когда её план наконец сработал.")]), ''' s=s.replace("V=[\n",new,1) s=s.replace("24 words from","26 words from") open('build.py','w').write(s) EOF python3 build.py && python3 -c " import pdfplumber with pdfplumber.open('Vocabulary_Handbook_Conflict_and_Resolution.pdf') as p: print(len(p.pages)); print(p.pages[0].extract_text()); print(p.pages[2].extract_text()[:300]); print(p.pages[-1].extract_text()[:120]) "
Vocabulary Handbook Conflict and Resolution
PDF Document · PDF
I can't see those 2 vocabulary added in new handbook colorful pdf
cd /tmp/workspace/vocab-handbook && cp Vocabulary_Handbook_Conflict_and_Resolution.pdf Vocabulary_Handbook_26_Words.pdf && python3 -c " import pdfplumber with pdfplumber.open('Vocabulary_Handbook_26_Words.pdf') as p: print(len(p.pages)) for i in (1,2): print('--- page',i+1); print(p.pages[i].extract_text()[:700]) " ; ls -la
Vocabulary Handbook 26 Words
PDF Document · PDF
Please describe the photo for C1 advance proficiency Cambridge speaking practice test for my ESL student using all these vocabulary list in handbook pdf prepared by you above.
Please create a colorful handbook pdf
cd /tmp/workspace/vocab-handbook && python3 -c " from PIL import Image im=Image.open('/tmp/workspace/attachments/ca209389-5672-4552-888f-7f80227d120d/IMG-20261111-WA0017.jpg');print(im.size)"
cd /tmp/workspace/vocab-handbook && cat > build2.py <<'EOF' import re src=open('/tmp/workspace/vocab-handbook/build.py').read() head=src.split("def card(")[0] # imports, fonts, V, PAL, styles exec(head) from reportlab.platypus import Image, NextPageTemplate IMG='/tmp/workspace/attachments/ca209389-5672-4552-888f-7f80227d120d/IMG-20261111-WA0017.jpg' idx={v[0]:i for i,v in enumerate(V)} def mark(text): def rep(m): disp,key=m.group(1),m.group(2) d,l=PAL[idx[key]%len(PAL)] return f'<font backColor="{d}" color="white"><b> {disp} </b></font>' return re.sub(r'\[\[(.+?)\|\|(.+?)\]\]',rep,text) PITS="pits (someone) against (someone else)" paras=[ ("1. Describe the photo", "The photo shows a large, tightly packed crowd sitting close together outdoors, and almost everyone is beaming at the camera. In the foreground, a woman with sunglasses on her head is laughing out loud. Others are clapping, waving, or even raising a fist in the air. On the left, a woman is holding a toddler who looks rather serious, which is a funny contrast to all the grinning around him. Many people are wearing white T-shirts, a few [[emblazoned||emblazoned]] with what looks like a peace logo. The caption tells us they are international students at the University for Peace in Costa Rica, and they come from over 45 countries."), ("2. Contrast with competition", f"What strikes me first is the [[symbolism||symbolism]] of the scene: the white clothes, the mix of nationalities and the warm atmosphere. Nobody looks [[antagonistic||antagonistic]], and nobody seems to be trying to [[have the upper hand||have the upper hand]] over anyone else. That is the opposite of many [[rivalries||rivalries]], for example a football tournament that [[pits||{PITS}]] one country [[against||{PITS}]] another, where the teams [[battle it out||battle (it) out]] in front of angry fans."), ("3. Speculate about their studies", "I would guess these students are on an [[interdisciplinary||interdisciplinary]] course that combines politics, law, history and psychology. They probably study how a quarrel [[escalated||escalated]] into violence, how a war [[raged||raged]] for years, or how a town spent months under [[siege||siege]]. They also learn what comes next: a [[ceasefire||ceasefire]], peace [[settlements||settlements]], an [[amnesty||amnesty]] for former fighters, [[the disbanding of||the disbanding of]] armed groups, and finally the [[reintegration||reintegration]] of those people into society."), ("4. Give your opinion", "Their goal is probably to [[foster||foster]] [[lasting||lasting]] [[reconciliation||reconciliation]] and to build [[inclusivity||inclusivity]], so that every group feels it has a voice. Some people might say that peace studies is a [[fringe area||fringe area]], [[albeit||albeit]] one that has [[proliferated||proliferated]] in universities over the last few decades. Critics may also dismiss the students' [[assertions||assertions]] that peace can be taught. Personally, I think this joyful picture suggests that these young people feel [[vindicated||vindicated]], as if they have proved the sceptics wrong. They try to [[reframe||reframe (something)]] conflict, not as something inevitable but as a problem that people can solve together."), ] sH=S('h',fontName='B',fontSize=20,leading=26,textColor=colors.HexColor('#1B1B3A')) sSec=S('sec',fontName='B',fontSize=11.5,leading=15,textColor=colors.white) sTxt=S('tx',fontSize=10.2,leading=19) sSm=S('sm',fontSize=9.5,leading=14) def banner(txt,col): t=Table([[Paragraph(txt,sSec)]],colWidths=[CW]) t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),colors.HexColor(col)),('LEFTPADDING',(0,0),(-1,-1),10), ('TOPPADDING',(0,0),(-1,-1),4),('BOTTOMPADDING',(0,0),(-1,-1),5)])) return t def box(flow,dark,light): t=Table([[flow]],colWidths=[CW]) t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),colors.HexColor(light)),('BOX',(0,0),(-1,-1),1.2,colors.HexColor(dark)), ('LEFTPADDING',(0,0),(-1,-1),10),('RIGHTPADDING',(0,0),(-1,-1),10),('TOPPADDING',(0,0),(-1,-1),8),('BOTTOMPADDING',(0,0),(-1,-1),8)])) return t def cover(c,doc): c.saveState() bands=[p[0] for p in PAL]; bh=H/len(bands) for i,b in enumerate(bands): c.setFillColor(colors.HexColor(b)); c.rect(0,H-(i+1)*bh,W,bh,stroke=0,fill=1) c.setFillColor(colors.white); c.roundRect(1.6*cm,H/2-8.2*cm,W-3.2*cm,16.4*cm,20,stroke=0,fill=1) c.setFillColor(colors.HexColor('#1B1B3A')); c.setFont('B',28) c.drawCentredString(W/2,H/2+5.6*cm,"C1 ADVANCED") c.drawCentredString(W/2,H/2+4.0*cm,"SPEAKING HANDBOOK") c.setFillColor(colors.HexColor('#C2349B')); c.setFont('B',14) c.drawCentredString(W/2,H/2+2.8*cm,"Describe the photo using the Unit 6 vocabulary") iw=W-5*cm; ih=iw*766/1600 c.drawImage(IMG,2.5*cm,H/2+2.0*cm-ih-0.2*cm,width=iw,height=ih) c.setFillColor(colors.HexColor('#444444')); c.setFont('R',11) y=H/2+2.0*cm-ih-1.2*cm c.drawCentredString(W/2,y,"Model answer \u2022 26 highlighted vocabulary words") c.drawCentredString(W/2,y-0.7*cm,"Follow-up questions \u2022 Speaking tips \u2022 Word checklist") c.drawCentredString(W/2,y-1.6*cm,"Устный ответ по фотографии: образец, вопросы и советы") c.restoreState() def normal(c,doc): c.saveState() c.setFillColor(colors.HexColor('#5B4FCF')); c.rect(0,H-0.45*cm,W,0.45*cm,stroke=0,fill=1) c.setFillColor(colors.HexColor('#E8A800')); c.rect(0,0,W,0.35*cm,stroke=0,fill=1) c.setFillColor(colors.HexColor('#555555')); c.setFont('R',8) c.drawCentredString(W/2,0.65*cm,f"C1 Advanced Speaking Handbook | Conflict and resolution | {doc.page-1}") c.restoreState() doc=BaseDocTemplate('/tmp/workspace/vocab-handbook/C1_Speaking_Photo_Handbook.pdf',pagesize=A4, title='C1 Advanced Speaking Handbook - Describe the photo',author='Orris') fr=Frame(1.2*cm,1.1*cm,W-2.4*cm,H-2.0*cm,leftPadding=0,rightPadding=0,topPadding=0,bottomPadding=0) doc.addPageTemplates([PageTemplate('cover',frames=[fr],onPage=cover),PageTemplate('main',frames=[fr],onPage=normal)]) st=[NextPageTemplate('main'),PageBreak()] # Page 2: task + photo + useful phrases st+=[Paragraph("The Task",sH),Spacer(1,6)] iw=CW; ih=iw*766/1600 st.append(Image(IMG,width=iw,height=ih)); st.append(Spacer(1,8)) st.append(box(Paragraph("<b>Examiner:</b> \u201cHere is a photograph of a group of people. Describe what you can see and say why you think the people might be feeling this way.\u201d<br/><br/><b>Timing:</b> about 1 minute for the description, then a short follow-up question.<br/><br/><b>Задание:</b> опишите фотографию и объясните, почему, по вашему мнению, люди так себя чувствуют (около 1 минуты).",sSm),'#1D7FD6','#E1EFFC')) st.append(Spacer(1,10)) st.append(banner("USEFUL PHRASES FOR DESCRIBING A PHOTO / ПОЛЕЗНЫЕ ФРАЗЫ",'#2A9D4B')) ph=[("Position","In the foreground / background, on the left / right, in the centre"), ("Speculating","I would guess that\u2026, They probably\u2026, It might be\u2026, It looks as if\u2026"), ("Contrasting","That is the opposite of\u2026, whereas\u2026, in contrast to\u2026"), ("Giving opinion","Personally, I think\u2026, What strikes me is\u2026, I get the impression that\u2026")] rows=[[Paragraph(f"<b>{a}</b>",sSm),Paragraph(b,sSm)] for a,b in ph] t=Table(rows,colWidths=[3.3*cm,CW-3.3*cm]) t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),colors.HexColor('#E3F5E9')),('ROWBACKGROUNDS',(0,0),(-1,-1),[colors.HexColor('#E3F5E9'),colors.HexColor('#F3FBF6')]), ('BOX',(0,0),(-1,-1),1.2,colors.HexColor('#2A9D4B')),('VALIGN',(0,0),(-1,-1),'TOP'),('TOPPADDING',(0,0),(-1,-1),5),('BOTTOMPADDING',(0,0),(-1,-1),5),('LEFTPADDING',(0,0),(-1,-1),8)])) st.append(t) st.append(PageBreak()) # Page 3: model answer st+=[Paragraph("Model Answer",sH),Paragraph("All 26 vocabulary words are highlighted in the colour of their handbook card.",S('x',fontSize=9,textColor=colors.HexColor('#555555'))),Spacer(1,6)] cols=['#5B4FCF','#E63946','#00A6A6','#C2349B'] for (title,txt),c_ in zip(paras,cols): st.append(KeepTogether([banner(title,c_),box(Paragraph(mark(txt),sTxt),c_,'#FFFFFF'),Spacer(1,7)])) st.append(PageBreak()) # Page 4: questions, tips st+=[Paragraph("Follow-up Questions",sH),Spacer(1,6)] qs=["Why do you think the people look so happy?","Do you think universities should teach peace studies? Why or why not?","How can ordinary people help to build lasting peace in their own communities?"] for i,q in enumerate(qs): st.append(box(Paragraph(f"<b>{i+1}.</b> {q}",sBody),PAL[i+3][0],PAL[i+3][1])); st.append(Spacer(1,5)) st.append(Spacer(1,6)) st.append(banner("TIPS FOR THE STUDENT / СОВЕТЫ",'#F4811F')) tips=["The photo shows only a happy crowd. The peace-studies ideas (ceasefire, amnesty and so on) are speculation, so use phrases like \u201cI would guess\u201d, \u201cthey probably\u201d and \u201cit might be\u201d.", "A real exam answer is about 1 minute, so this model is longer than needed. Try using 10 to 12 of the words per attempt, then rotate through the list.", "Start with what you can see, then move to ideas and opinions.", "Не нужно использовать все слова сразу: выбирайте 10\u201312 слов и меняйте их при каждой попытке."] st.append(box([Paragraph("\u2022 "+t_,sSm) for t_ in tips],'#F4811F','#FEEFDF')) st.append(Spacer(1,10)) # checklist st.append(banner("VOCABULARY CHECKLIST / СПИСОК СЛОВ",'#1B1B3A')) st.append(Spacer(1,4)) cells=[] for i,v in enumerate(V): cells.append(Paragraph(f'<font color="white"><b>\u2610 {v[0] if len(v[0])<26 else "pits (someone) against"}</b></font>',S('cc',fontSize=8.8,leading=11,textColor=colors.white))) if len(cells)%3: cells+=['']*(3-len(cells)%3) rows=[cells[i:i+3] for i in range(0,len(cells),3)] t=Table(rows,colWidths=[CW/3]*3,rowHeights=0.8*cm) ts=[('VALIGN',(0,0),(-1,-1),'MIDDLE'),('LINEBELOW',(0,0),(-1,-1),3,colors.white),('LINEAFTER',(0,0),(-1,-1),3,colors.white)] for i in range(len(V)): ts.append(('BACKGROUND',(i%3,i//3),(i%3,i//3),colors.HexColor(PAL[i%len(PAL)][0]))) t.setStyle(TableStyle(ts)); st.append(t) doc.build(st) EOF python3 build2.py && python3 -c " import pdfplumber with pdfplumber.open('C1_Speaking_Photo_Handbook.pdf') as p: print(len(p.pages)) for i,pg in enumerate(p.pages): w=pg.extract_words(); print(i+1,max(x['bottom'] for x in w if x['bottom']<820) , pg.extract_text()[:90].replace('\n',' | ')) "
C1 Speaking Photo Handbook
PDF Document · PDF