Analyzing the Pros and Cons of Electric Vehicle Purchases: Insights from Newspaper News

In today's market, buying electric cars represents an important challenge and a purchase decision that we have to evaluate carefully. Many consumers face the uncertainty of choosing between a conventional combustion vehicle or an electric car. This decision is critical since buying a car involves a significant economic expenditure.
The information on whether to buy an electric vehicle is still unclear due to uncertainties in the market regarding the possible full adoption of electric vehicles. Furthermore, many websites and news about electric vehicles are outdated, providing information that does not reflect the actual situation, making it difficult to make an informed decision.
For this reason, the goal of this article is to provide an analysis of recent news in the area of electric cars. Analyzing newspaper news, we can identify both the positive and negative aspects related to buying an electric vehicle today. This analysis of recent news can provide us with an updated view of the current situation, allowing us to make up-to-date decisions rather than decisions based on outdated data.
Gathering Recent News Articles on Electric Vehicles
Our analysis begins with obtaining news articles on Electric Vehicles from which we will extract both the positive and negative aspects of potentially purchasing an electric vehicle over a conventional one.
There are numerous APIs and databases containing news articles. Most of them offer a free version with a limited number of API calls and only for recent articles, not historical ones. In our case, this is not a problem since our analysis is only focused on evaluating the most recent articles.
In this article, we will use the World News API to obtain the news. However, for a larger project, it would be necessary to evaluate the pros and cons of different APIs available in the market to determine which one of those provides the better quality data for the question we want to answer.
In its free version, this API allows us to make 50 calls per day and access articles up to 1 month old, which is sufficient for the test we intend to conduct. Always keep in mind that this article is a simple example of how news can be used to extract information. From this basic example, more complex products could be developed following the same concept.
For this task, we will obtain only 10 articles using the API. The code below will be used, defining only three parameters : (1) api_key
necessary for making calls, (2) text
to match in the news content, and (3) source-countries
, a comma-separated list of ISO 3166 country codes from which the news should originate. The API documentation summarizes all configurable parameters for the API call. It is important to note that by default, the API returns only 10 articles. This parameter is configurable and can be increased. Additionally, to access different articles in multiple calls, the offset
parameter can be adjusted.
The next step is to make an API call and then store the articles in a DataFrame
, as shown below.

The API response includes the following keys:
- offset: indicates the starting point for the results returned. This parameter can help in paginating through the results.
- number: represents the number of articles returned in the response.
- available: shows the total number of articles available that match the query.
- news: contains the list of news articles returned by the API.
In this case, as shown in the previous code, we have limited ourselves to making API calls and storing the results in a DataFrame. Only the news text is used in the subsequent sections of this project. However, additional information about the article, such as details about the author and the publication source and date, is also returned.
Utilizing Mistral LLMs for Advanced Information Extraction from News Sources
When we think of large language models (LLMs), we automatically think of OpenAI and the models it offers. However, there are many other LLMs in the market provided by various companies that deliver results comparable to those offered by OpenAI. In this article, we will utilize one of the models offered by Mistral. Mistral is a French start-up that, like OpenAI, provides an interesting array of different Large Language Models (LLMs). These models can be accessed through the chat available on their website, as well as via an API.
In this case, we will use the API to create a fully integrated environment in Python. To do this, just as we do with Open AI, we need to create an account with Mistral to obtain the API key. After creating the account, you will receive a €5 credit, which will be more than enough to run this project on your computer.
To interact with the API, we will first create a generic function that can easily adapt to different problems to be solved. The function has mainly three inputs:
- prompt: This is equivalent to what we type in the chat when interacting with LLM models through the front-end.
- agent: This adds context to the LLM.
- model: This specifies the model we will use, as Mistral offers a wide variety of models.
Additionally, we will provide the API key via headers to interact with the model.
If the call is successful, meaning the status code is 200, the function will return the content received from the API. If there is an error, the function will return None. It is important to note that the response format can be specified through the prompt we send to the LLM, as will be demonstrated later.
Customizing the Prompt for Analyzing News Articles
The next step consists of customizing the prompt to interact with the LLM model. This step will require many attempts and readjustments, since it is rare for the initial prompt to yield the desired results, either in terms of output format or the results themselves. There are numerous courses and articles available to master this technique, and likely the way we write prompts will vary in the coming months and years as LLMs improve and provide more accurate results.
In this case, the prompt we have found to be most effective for extracting various aspects from the news articles is the following:
In the prompt, the output format and the fields we want in the output are specified. Specifically, we are looking for four fields:
- Aspect: This refers to the topic for which information has been found in the article.
- Sentence: This refers to the specific sentence from the article related to the topic.
- Explanation: This is the LLM's interpretation of the sentence.
- Sentiment: This indicates whether the sentiment is positive or negative regarding the purchase of an electric vehicle.
The prompt also specifies that the focus should be on general topics related to electric vehicles since there are articles that compare specific models, which is not the information we are looking for. Additionally, we have specified the default response for the cases where relevant aspects in the news related to electric vehicles are not found.
Pipeline for Extracting Aspects from News Articles
After defining both the function for interacting with the Mistral LLM and the prompt, we proceed to extract the aspects from the 10 selected articles. You can try to run the code below on your computer with more articles to gather additional insights.
Once the aspects from the articles are extracted, we store all the outputs in a list. Afterwards, we can easily convert this list into a DataFrame. This process will be straightforward due to the output format we specified in the prompt.


Refining Aspects into Broader Terms
The main challenge when extracting aspects using an LLM is that they tend to generate diverse aspects. To visualize them properly in a graph, it is necessary to categorize them into broader terms, otherwise, we will have a large list of topics. For this reason, we will create a new column in the dataset called category
.
To create these new categories, we will utilize the previously developed function, designing a new prompt adapted to the problem we want to solve now.

Results Visualization and Key Information Extraction
After clustering the aspects, we have the data frame ready for extracting conclusions. We visualize the data using Plotly, focusing on analyzing the positive and negative aspects found in each category.
The following code shows how to create the visualization, where the rows represent each aspect and the columns show the number of times the aspect was found in the news scanned.

The visualization includes hover-overs where we can see the news article sentences and also the interpretations made by the LLM for each sentence.

Now we can use the chart to draw conclusions.
Conclusions Drawn from News Articles on the Decision to Purchase Electric Vehicles
Let's recall the starting point and motivation of the article: We know that electric vehicles are increasingly gaining importance, but we are unsure whether it currently makes sense to purchase an electric car or if it still makes sense to buy an internal combustion engine car. Therefore, due to the often outdated information available online, we have decided to download recent news and evaluate their content using Mistral's large language model to extract arguments both for and against electric vehicles. This will help us make an informed purchasing decision.
After analyzing and visualizing the results, the following conclusions can be drawn, among others:
- Range Anxiety: There are still many concerns among consumers about the range of electric vehicles, which, according to the news, is still lower than that of internal combustion vehicles. The range also significantly depends on weather conditions and the driver's driving style.
- Charging Infrastructure: In the United States, the number of public electric vehicle charging stations has increased considerably in recent years. However, the number of stations is still much lower than that of fossil fuel stations (approximately half). Additionally, only a little over 10 percent of electric vehicle charging stations correspond to fast-charging stations.
- Cost: Electric vehicles are more expensive to buy and repair. However, the savings on fuel are significant.
- Government Policies: The U.S. government has promised a significant increase in the number of public charging stations by 2030 (500,000 charging stations). Additionally, the government has also promised to help in the tax payments when purchasing electric vehicles.
News is a highly valuable source of information that can be used to make informed up-to-date decisions. However, extracting key aspects from news articles can often be challenging due to the large volume of information available online, not all of which is relevant to the specific question we want to answer. In this context, large language models are incredibly useful for detecting crucial information to answer specific questions.
In this article, current news related to electric vehicles has been analyzed to evaluate whether purchasing an electric vehicle makes sense today. A large language model from Mistral was utilized for extracting arguments both for and against electric cars. Finally, these arguments are visualized using Plotly to obtain a general perspective. This analysis has allowed us to evaluate the current state of electric vehicles in the United States.
Thanks for reading,
Amanda Iglesias