Tag Archives: Barbary Wars

Text Analysis on the Documents of the Barbary Wars

This past semester, I took a graduate seminar in Humanities Data Analysis, taught by Professor Ben Schmidt. This post describes my final project. Stay tuned for more fun Bookworm stuff in the next few days (part 2 on Civil War Navies Bookworm is here).


In the 1920s, the United States government decided to create document collections for several of its early naval wars: the Quasi-War with France, the Barbary Wars, and the Civil War (the War of 1812 did not come until much later, for some reason). These document collections, particularly for the Quasi-War and the Barbary Wars, have become the standard resource for any scholar doing work on these wars. My work on the Barbary Wars relies heavily on this document collection. The Barbary Wars collection includes correspondence, journals, official documents such as treaties, crew manifests, other miscellaneous documents, and a few summary documents put together in the 1820s. 1

It’s quite easy to get bogged down in the multiplicity of mundaneness in these documents—every single day’s record of where a ship is and what the weather is like, for instance. It’s also easy to lose sight of the true trajectory of the conflict in the midst of all this seeming banality. Because the documents in the collection are from many authors in conversation with each other, we can sometimes follow the path of these conversations. But there are many concurrent conversations, and often we do not have the full correspondence. How can we make sense of this jumble?

Continue reading Text Analysis on the Documents of the Barbary Wars


  1. U.S. Office of Naval Records and Library, Naval Documents Related to the United States Wars with the Barbary Powers (Washington: U.S. Govt. Print. Off., 1939); digitized at http://www.ibiblio.org/anrs/barbary.html.

Another Look at Our Diplomatic Graph

I wrote yesterday about my network graph about U.S.-Barbary diplomatic relations. The graph I showed was color-coded by nationality. That code was hand-inputted by me, no computation or algorithm necessary.

A perhaps more interesting, and enigmatic, color-coding is the result of running a modularity algorithm in Gephi. This algorithm creates sub-communities from the large network graph. I will not lie: I do not understand the math behind the result. But the communities created by the algorithm are quite interesting.

I find a few things interesting about these communities:

  • James Leander Cathcart and Hasan, dey of Algiers, are in two different communities. This is interesting because Cathcart is probably the person with the most access to Hasan in the entire graph. He was an American captive who worked his way up the ranks into Hasan’s household and became a fairly high-ranking official in the court of the dey. I have two theories for why these communities formed this way. (1) Cathcart’s relationship with the dey was largely informal, not something that got memorialized in writing or official documents. Thus, the “paper trail” on their relationship might be thin. (2) Cathcart did talk a lot to the dey. We know that. But it’s possible that his major contributions to the diplomatic situation in Algiers were not his communications with the dey, but his communications with the outside world. 
  • Many of the European diplomats who were assisting from the outside fall into the same community, which they share with Thomas Jefferson (then-secretary of state). All, or nearly all, of the people in that community were never in Algiers. It makes sense that they would be placed together. The other interesting person in that community is John Lamb, the first American sent to negotiate with Algiers. I’m wondering whether he is in that community because he had much better success dealing with the Europeans than with the dey.




A Graph of Diplomatic Wrangling in Algiers

When the United States became independent after the American Revolution, it had to struggle to protect its seaborne commerce in the Atlantic and Mediterranean. Americans had to rely on the goodwill of France, Portugal, and other European powers because the United States lacked the naval power necessary to protect its own shipping.

Historical Background 

Americans had to negotiate with the Barbary states to secure the release of hostages, taken by Barbary corsairs, and to decide how much tribute would guarantee the safety of American shipping. The United States quickly felt the bite of diplomatic and military impotence. American diplomats, who had little power of their own, had to rely on the good graces of many others with better connections to the Algerine court. Sometimes, those others helped the American cause; at other times, they weren’t all that helpful; and on a few occasions, they purposely derailed American negotiations.

Richard B. Parker writes about the United States’ relationship with Algiers in Uncle Sam in Barbary: A Diplomatic History, which details the complicated and sometimes absurd relationships of American diplomats, European diplomats and dignitaries, and the court of the Algerine dey. The story is quite complex, which makes it difficult to understand in a narrative, and Parker’s organization doesn’t help matters. (A quick shout-out to Jean Bauer, whose Early American Foreign Services Database was extremely helpful in elucidating the roles of some diplomats whom Parker does not adequately identity.)

The story of American-Barbary diplomacy is all about relationships. Naturally, a story about relationships suggests a network graph as a way to make the situation more intelligible.

Parameters and Characteristics of the Graph

To represent the American-Barbary diplomatic network, I created the graph in Gephi. I hate Gephi. I like Gephi. (You know what I mean.) This graph represents interactions from approximately 1785 to 1800. The last interaction I recorded was between the dey of Algiers and William Bainbridge in September 1800; this interaction was the first one in which the navy was directly involved (though it was a diplomatic interaction, not a military one). I decided to end my graph there because I’m most interested in how the navy changed things for U.S. relations with the Barbary states and with the European nations who had hitherto helped those relations.

The nodes are people who had a connection to Barbary diplomacy. The edges are letters and meetings that Parker writes about. I checked up on as many as I could using American State Papers, and I will continue to document the interactions more explicitly than Parker does in his bibliography (where he only records the collection, not the exact document, his source comes from). 

 Each node is color-coded by nationality; the next step is also to record where these people were actually living while they were engaged in Barbary negotiations. 

Green: Algiers
Red: United States
Purple: England
Light blue: Tripoli
Darker blue: France
Light purple: Spain
Yellow: Portugal
Orange: Sweden

The graph isn’t perfect (obviously). There’s a lot more to be done here. This graph is based solely on Parker’s book, which I’m not wholly convinced is accurate. In addition, Parker addresses only diplomatic relations with Algiers, not the other three Barbary states (Tripoli, Tunis, and Morocco). Furthermore, I haven’t attached dates to each edge, simply because Parker doesn’t provide dates for all of the interactions. A more dynamic timeline of the network changes would be most instructive. So there’s a lot more data that needs to be added to this graph. But I think it’s a good start toward understanding the global nature of American relations with the Barbary states, which culminated in the Barbary Wars of 1801-1805 and 1815.