<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Paola Villarreal on Medium]]></title>
        <description><![CDATA[Stories by Paola Villarreal on Medium]]></description>
        <link>https://medium.com/@pawmx?source=rss-24e830196c38------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*l4LVFefDonUjBh8ot_uyMg.jpeg</url>
            <title>Stories by Paola Villarreal on Medium</title>
            <link>https://medium.com/@pawmx?source=rss-24e830196c38------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 10:07:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pawmx/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Data-driven, AI-assisted Job Hunting]]></title>
            <link>https://medium.com/@pawmx/data-driven-ai-assisted-job-hunting-24533c033abf?source=rss-24e830196c38------2</link>
            <guid isPermaLink="false">https://medium.com/p/24533c033abf</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Paola Villarreal]]></dc:creator>
            <pubDate>Mon, 27 Feb 2023 16:58:58 GMT</pubDate>
            <atom:updated>2023-02-27T19:12:50.276Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Using GPT-3 and other Natural Language Processing models and Information Extraction techniques to assist candidates in their job hunting.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tTZSIwVMD0n1uupXZOsGGQ.png" /></figure><h3>Introduction</h3><p>Job searching can be a daunting task with multiple factors that only add uncertainty: limited offerings, fierce competition, scarce information and almost null feedback/reinforcement.</p><p>Algorithms help recruiters classify applications and interoperable systems allow them to spread out and reach potential candidates across multiple platforms quite easily. Candidates, on the other hand, don’t have a lot of tools available to them: people normally find a job posting they are interested in either by going directly to the company’s careers website or through the recommendation algorithm of social networks like LinkedIn but a systematic way of gathering information, analyzing it and tracking it is not easily available to them.</p><p>That’s why I decided to put some effort into building a system to gather information from job postings into a single database: companies, job titles, job descriptions, minimum requirements, salaries, benefits, locations, etc.</p><p>I also want to track the whole process and visualize it as a funnel with steps from Discovery, Application, Initial Conversation, Interviewing Loop, Decision, Offer, Acceptance. But this will come in a second part of this series.</p><p>This post describes the step-by-step process of collecting and processing the information, analyzing it and tracking the applications. Let’s start with Data Sources.</p><h3>Data Sources</h3><p>Normally, I’ve been able to find interesting job posts on LinkedIn but LinkedIn doesn’t have an API that allows you to search job recommendations in a programmatic way so I decided to just collect the links to the job posts in a Google Doc which I can also share with other people looking for similar opportunities.</p><p>Of course, I can build a more sophisticated crawler to do job discovery on the open web but that might be a little more overkill for my immediate purposes but perhaps, I’ll look into it in the future.</p><p>So, to obtain a list of jobs we are interested in, we need to parse a Google Doc, find all the links, pay them a visit, parse their HTML and collect the precious information in a database.</p><h3>Step 0: environmental variables and project setup</h3><p>Because we will be using many different services, it is healthy to create a separate file with our environmental variables to put sensitive information (such as API keys) in.</p><pre><br>from dotenv import load_dotenv<br>from pathlib import Path  # Python 3.6+ only<br>env_path = Path(&#39;.&#39;) / &#39;.jobhunter.env&#39;<br>load_dotenv(dotenv_path=env_path)</pre><pre>OPENAI_API_KEY=&quot;&lt;YOUR API KEY&gt;&quot;<br>SCOPES = [&#39;https://www.googleapis.com/auth/documents.readonly&#39;]<br>LIST_ID = &#39;&lt;YOUR GOOGLE DOC ID WITH LINKS&gt;&#39;</pre><pre>import pandas as pd<br>import selenium<br>from selenium import webdriver<br>from selenium.webdriver.chrome.options import Options<br><br>from IPython import display<br>from base64 import b64decode<br><br>from trafilatura import extract<br>from lxml import html<br>import os.path<br><br>from google.auth.transport.requests import Request<br>from google.oauth2.credentials import Credentials<br>from google_auth_oauthlib.flow import InstalledAppFlow<br>from googleapiclient.discovery import build<br>from googleapiclient.errors import HttpError</pre><h3>Step 1: Produce a list of links</h3><p><em>Tip: You could skip the Google Docs parsing part and just create a list with all the urls you want to crawl.</em></p><p>To being able to access a google doc you own, you just have to create a Google Developer account, create a project, enable the Google Docs API, obtain the OAuth credentials for your Desktop Application and authenticate with your Google Account which will produce a OAuth token that you’ll use to make requests. I am going to assume you already have the token saved in a file token.json.</p><pre>creds = None<br>if os.path.exists(“token.json”):<br> creds = Credentials.from_authorized_user_file(“token.json”, SCOPES)<br>else:<br> # do the OAuth dance<br>try:<br> service = build(‘docs’, ‘v1’, credentials=creds)<br> document = service.documents().get(documentId=LIST_ID).execute()<br>except HttpError as err:<br> print(err)</pre><p>Now, <em>document</em> contains our document as an object. It basically has a body with content and paragraphs. We can extract the links in the doc with this two elegant pythonesque lines (this could be a single one but alas…):</p><pre>con = [d.get(‘paragraph’) for d in document.get(‘body’).get(‘content’) if d.get(‘paragraph’) is not None]<br>links = [c[‘elements’][0][‘textRun’][‘textStyle’][‘link’][‘url’] for c in con if len(c[‘elements’]) &gt; 0 and ‘textRun’ in c[‘elements’][0] and ‘link’ in c[‘elements’][0][‘textRun’][‘textStyle’]]</pre><p>This produces a list of links:</p><pre>links = [<br> &#39;https://boards.redhouse.io/socialmediaco/jobs/4794726&#39;,<br> &#39;https://www.bigtech.com/listing/291a&#39;,<br> &#39;https://www.othertech.com/jobs/awesome-job-30129a&#39;,<br>]</pre><h3>Step 2: Crawl web pages, obtain HTML and take a screenshot</h3><p>This sounds simple but if you try to use a common http-client such as urllib.request you’ll start to face obstacles very soon as somewebsites load their content through an XMLHttpRequest instead of putting it directly in the HTML. They might also rely on JavaScript or Cookies which can be a hassle to handle.</p><p>Solution: run a real web browser in python. This is possible thanks to an awesome piece of software which is normally used to run automated unit tests on web sites as if a real user was browsing and interacting with it: <a href="https://pypi.org/project/selenium/">Selenium</a>. Just follow the instructions, install Selenium and a webdriver for either Firefox, Chrome, Safari or Edge and you’re all set.</p><p>I wanted to take a screenshot for debugging purposes. This has already proven useful when the machine I am running this got its clock stuck in February 15th which triggered an error in some websites.</p><p>I am going to assume you’ve installed Selenium and a webdriver so you can run this code:</p><pre>screenshots = []<br>sources = []<br>titles = []<br>options = Options()<br>options.add_argument(“ — headless=new”)<br><br>driver = webdriver.Chrome(“/usr/bin/chromedriver”, options=options)<br>driver.maximize_window()<br> <br>for link in links:<br> driver.get(link)<br> titles.append(driver.title)<br> screenshots.append(b64decode(driver.get_screenshot_as_base64()))<br> sources.append(driver.page_source)<br><br>driver.quit()</pre><p>It’s that easy. We now have the HTML source, the page title and a screenshot of every webpage in our links list.</p><h3>Processing raw data</h3><h3>Step 3: extract the relevant text from noisy HTML</h3><p>At this point we have raw HTML from a diverse set of websites, each of them pose a unique challenge because every website has its own structure which makes it hard to build a works-for-all parser unless we start digging into corpus processing tools that can help us extract the relevant text of each website which, in turn, will enable the usage of Natural Language Processing models. Enter <a href="https://trafilatura.readthedocs.io/en/latest/#description">Trafilatura</a>.</p><blockquote>“Trafilatura is a <strong>Python package and command-line tool</strong> designed to gather text on the Web. It includes discovery, extraction and text processing components. Its main applications are <strong>web crawling, downloads, scraping, and extraction</strong> of main texts, metadata and comments. It aims at staying <strong>handy and modular</strong>: no database is required, the output can be converted to various commonly used formats.”</blockquote><pre>from trafilatura import extract<br>texts = [extract(s) for s in sources]</pre><p>Voilà! these two lines are enough to go from noisy HTML from a website like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*kJsU1xFjGRaZikyY4-zfIQ.png" /><figcaption>actual screenshot produced by Selenium</figcaption></figure><p>To text like this:</p><pre>AIML - Sr Data Science Manager, AIML Data<br>Santa Clara Valley (Cupertino), California, United States<br>Machine Learning and AI<br>Do you get excited by driving product impact via measurement and evaluation, for products and services used by hundreds of millions of people globally? The vision for the AIML Data organization is to improve products by using data as the voice of our customers. You will lead and continue to grow a team of data scientists specializing in experimentation. The team will be responsible for evaluating the impact of products or components, scaling statistical algorithms, metrics development, experimentation and opportunity analysis.<br>Key Qualifications<br>- A passion for and track record in data analysis, A/B testing, and shaping data culture.<br>- 5+ years in a managerial role, recruiting top talent, growing, and scaling analytics organizations.<br>- Ability to manage complex relationships across multiple functions and establish strong partnerships.<br>- Outstanding communication and presentation skills, written and verbal, to all levels of an organization.<br>- Technical expertise: experience in AB testing, statistical algorithms and developing analytic recommendations.<br>- Technical rigor - ability to work with engineering teams and develop sustainable solutions for rigorous analytics.<br>- Experience working with systems and products that are powered by machine-learned models and an understanding of natural language or speech-enabled products.<br>- Strong analytical product intuition - able to use data impact-fully in guiding development of products and user experiences.<br>Description<br>The Siri Assistant Analytics team is looking for an experienced and highly motivated data scientist lead! You will partner across engineering groups building Siri Assistant and the AIML products to develop and evangelize AB testing to measure, understand, and improve our products and features. You have a background that fuses data science, engineering, and product thinking. You have experience directing a team that loves to dive into data and experimentation to improve products. In this role, you will - Lead the AIML experiment science and methods team. - Work with platform teams to scale AB testing processes, practices and technical solutions across Apple product teams. - Drive high-impact exploratory analyses and investigations to enrich our understanding of how people interact our products. - Establish team capabilities through hiring, training, tools, and process. - Partner with product and engineering teams working to understand the user’s voice, and to communicate effectively on product impact, innovation, improvement, and growth.</pre><h3>Step 4: Understanding the text</h3><p>We’ve gone a long way and now we’ve extracted the relevant content from an assorted (and very diverse) set of websites but our goal is to extract key information from each job posting and save it in a centralized database.</p><p>To achieve that, we need to ‘understand’ each piece of text and ‘interrogate’ them using the same ‘questions’ so we can obtain structured answers that will enable us to create a dataset.</p><p>Our more traditional options include topic modeling (LDA), named entity recognition (NER) amongst others but they’re in the Information Extraction realm of NLP and this task might actually be a bigger fish to fry for them. Enter GPT-3 and its text-davinci-003 model.</p><blockquote>For applications requiring a lot of understanding of the content, like summarization for a specific audience and creative content generation, Davinci is going to produce the best results. These increased capabilities require more compute resources, so Davinci costs more per API call and is not as fast as the other models.</blockquote><blockquote>Another area where Davinci shines is in understanding the intent of text. Davinci is quite good at solving many kinds of logic problems and explaining the motives of characters. Davinci has been able to solve some of the most challenging AI problems involving cause and effect.</blockquote><blockquote>Good at: <strong>Complex intent, cause and effect, summarization for audience</strong></blockquote><p>We want Davinci to answer a set of questions about each of the job posts and output the answer in an structured way so we can parse it later.</p><p>A prompt to achieve this looks like this:</p><pre> prompt = f&#39;&#39;&#39;<br>Extract the important entities in the text below answering the following questions:<br>- What is the company?<br>- Which industry is this company in?<br>- What is this company dedicated to?<br>- What is the job title?<br>- When was this job posted? output a date<br>- What is the seniority level?<br>- Which team is this job in?<br>- What are the main responsabilities?  desired format csv<br>- What are the mininum requirements?  desired format: csv<br>- What is the technical expertise required?  desired format: csv<br>- What is the mininum education level?<br>- How many years of experience are required?<br>- What is the offered salary range? ouput a number<br>- Where is this job located? output city, state, country<br>- Provide a one line summary of this job description<br><br>Text: &quot;&quot;&quot;<br>{title}<br>{t}<br>&quot;&quot;&quot;<br>&#39;&#39;&#39;</pre><p>Notice that I included the title as it usually includes relevant information such as the job title and the company name.</p><p>So now we just need to query OpenAI’s API and save the responses.</p><pre>responses = []<br>for t,title in zip(texts, titles):<br>  response = openai.Completion.create(<br>      model=&quot;text-davinci-003&quot;,<br>      prompt=prompt,<br>      temperature=0,<br>      max_tokens=700,<br>      top_p=1,<br>      frequency_penalty=0,<br>      presence_penalty=0<br>    )<br>    if &#39;choices&#39; in response:<br>        responses.append(response[&#39;choices&#39;][0][&#39;text&#39;])</pre><p>We’ll get a response like this:</p><pre><br>Company: Apple<br>Industry: Machine Learning and AI<br>Dedicated to: Improving products by using data as the voice of customers<br>Job Title: Sr Data Science Manager, AIML Data<br>Date Posted: N/A<br>Seniority Level: Senior<br>Team: AIML Data<br>Responsabilities: Driving product impact via measurement and evaluation, evaluating the impact of products or components, scaling statistical algorithms, metrics development, experimentation and opportunity analysis<br>Minimum Requirements: A passion for and track record in data analysis, A/B testing, and shaping data culture, 5+ years in a managerial role, recruiting top talent, growing, and scaling analytics organizations, ability to manage complex relationships across multiple functions and establish strong partnerships, outstanding communication and presentation skills, written and verbal, to all levels of an organization, technical expertise: experience in AB testing, statistical algorithms and developing analytic recommendations, technical rigor - ability to work with engineering teams and develop sustainable solutions for rigorous analytics, experience working with systems and products that are powered by machine-learned models and an understanding of natural language or speech-enabled products, strong analytical product intuition - able to use data impact-fully in guiding development of products and user experiences<br>Minimum Education Level: N/A<br>Years of Experience: 5+<br>Salary Range: N/A<br>Location: Santa Clara Valley (Cupertino), California, United States<br>Summary: Lead and continue to grow a team of data scientists specializing in experimentation to improve products by using data as the voice of customers.</pre><p>Now it is just a matter of parsing all the responses into a pandas DataFrame for further processing and analyzing</p><pre>df = pd.DataFrame.from_records([{x[0]:&quot; &quot;.join(x[1:]).strip() for x in [l.split(&quot;:&quot;) for l in r.strip().splitlines()]} for r in responses])<br>print(df.columns)<br><br>#outputs: <br>[&#39;Company&#39;, &#39;Industry&#39;, &#39;Dedicated to&#39;, &#39;Job Title&#39;, &#39;Date Posted&#39;,<br>       &#39;Seniority Level&#39;, &#39;Team&#39;, &#39;Responsabilities&#39;, &#39;Minimum Requirements&#39;,<br>       &#39;Technical Expertise&#39;, &#39;Minimum Education Level&#39;, &#39;Years of Experience&#39;,<br>       &#39;Salary Range&#39;, &#39;Location&#39;, &#39;Summary&#39;, &#39;No job details found.&#39;,<br>       &#39;Posted Date&#39;, &#39;Responsibilities&#39;, &#39;Dedication&#39;, &#39;Post Date&#39;,<br>       &#39;Technical Expertise Required&#39;, &#39;Years of Experience Required&#39;]</pre><p>So you could do something very simple like this</p><pre>df[[&#39;Company&#39;, &#39;Job Title&#39;, &#39;Summary&#39;, &#39;Salary Range&#39;]]</pre><p>And get this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t7clASI4ML-47vnADK0c2Q.png" /><figcaption>sample output</figcaption></figure><h3>Conclusion and next steps</h3><p>To summarize our process, we obtained a list of links in a google doc, visited them and saved the raw HTML and took a screenshot using Selenium, extracted relevant text from the raw HTML using Trafilatura, and ‘understood’ the text and got structured answers using and used GPT-3 that we then put into a pandas DataFrame.</p><p>Now that we have our DataFrame, the immediate next step is to further process some fields like Responsibilities, Minimum requirements, and Technical Expertise to produce a list of concepts across all job posts which could enable future recommendations and better targeting.</p><p>I also want to build a small tracking system to gather statistics about applications, I imagine something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tTZSIwVMD0n1uupXZOsGGQ.png" /></figure><p>Also, this process is only implemented locally and it is somewhat slow (it takes approximately 3 minutes to process 15 job posts). Processes like this are good examples of how can search engines or specialized services (such as a Job Hunter app) can leverage new AI and ML models to streamline their pipelines and, of course, are perfect candidates for parallelization, etc. This might be the subject of a third chapter on this series.</p><h3>About me</h3><p>My name is Paola Villarreal and I’ve been doing software engineering and data science for governments, non-profits and tech companies since 1999. I am originally from Mexico City but currently live in Los Angeles where I am a Senior Manager of Data Science at one of the biggest social media companies in the U.S.</p><p>Want to know more about my work?</p><p>Watch this documentary produced by the Ford Foundation explaining how I helped the ACLU of MA obtain the largest mass dismissal of convictions in the history of the justice system using SQL</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Feq7IWRdOjk8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Deq7IWRdOjk8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Feq7IWRdOjk8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3aad3d60e8e38a6ab0924a73d9547b6/href">https://medium.com/media/c3aad3d60e8e38a6ab0924a73d9547b6/href</a></iframe><p>Also watch this conference I gave at Harvard’s Law School (as part of the Berkman Klein Center for Internet and Society)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQ4uPne3o9tc&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQ4uPne3o9tc&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FQ4uPne3o9tc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b9fade47b1da037583a31a7d7687efc/href">https://medium.com/media/0b9fade47b1da037583a31a7d7687efc/href</a></iframe><p>Don’t forget to follow me on <a href="https://www.linkedin.com/in/pawmx">LinkedIn </a>or <a href="https://twitter.com/paw">Twitter</a>. I am, btw, open for work.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24533c033abf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>