Bear With Me: Text Analysis

bear-sitting-at-the-computer

 

In the course of writing this blog, being a member of The Grey Company, general involvement in the player community, and creating the Hall of Beorn Card Search, I have the opportunity to see this game from many different perspectives. In this new segment, I want to provide insights into some of the work that goes into these various activities. While these segues might not be of interest to everyone, I am confident that they will be sufficiently relevant (and short) to be entertaining to many readers.

When not slaying Orcs, writing blog posts, or recording podcasts, I am a professional software developer. One of the nice things about this game is that it provides me a chance to apply concepts that I learn at my day job to help create tools for one of my favorite games. I have worked on many search engines over the course of my career, and Hall of Beorn Card Search ultimately came out of my desire to have a search engine for this game that worked the way I wanted it to.

While it may not have every feature that everyone wants, it is fast, accurate and extensive. I continue to release new features and card sets on a regular basis and am always open to suggestions from the community. Many user requests have already been added to my list of features to add. So if you don’t yet see your favorite feature, it could be that I just haven’t completed it yet.

Many users have requested the ability to create and save deck lists via the search engine. This is something that I would very much like to add, but it takes time, and it is something that I want to get right the first time. I would rather spend the necessary time in order to have a deck-building app that works and gets users excited, than rush out an ill-conceived mess that no one wants to use. The biggest barrier to adding these type of marquee features is time. Between my various responsibilities, it is hard to find time to even play the latest scenarios, much less work on all of these supplemental tools.

Daeron's RunesOne of the challenges in deck-building is finding cards that fit a particular role within a deck. The best designed decks have a very focused idea of what it is they intend to do, and exactly how they aim to achieve their goals. With that in mind, I added a new Category filter to the Hall of Beorn Card Search recently. For example, here are cards in the “Card Draw” category. This filter is specifically intended to help with deck design, when it comes time to add a particular element to a deck.

While it might at first seem mundane, this filter is a dramatic evolution for the search engine. Up to now, all of the filters available on Hall of Beorn Card Search have been based directly on individual data elements printed on the cards. Everything from the title, card set, stats, traits and keywords – even the artist can be derived directly from the card. The category filter is the first to use a more advanced and meaningful understanding of the cards in the game.

Category is a somewhat abstract concept. It requires looking at the card text and analyzing its meaning to derive the “intent” of the card. While this might at first seem entirely subjective, my goal has been to avoid that. I may at some point in the future add user ratings (e.g. 1 to 5 stars), reviews (“this card sucks”) and other subjective data, the goal for now is to apply strictly objective analysis of the cards.

In order to do that, I have designed the categories to be applied algorithmically. This is a fancy way of saying that I have a recipe to automatically categorize each of the player cards based on their text. While I may at some point categorize encounter and quest cards, that would be decidedly less valuable for my needs – as those cards are not built into player decks. In general, all of the upcoming features for Card Search are aimed at helping players with deck-building.

There are many advantages of this approach, not the least of which is how quickly I was able to implement it. Rather than pore over the hundreds of player cards in the game and manually assign categories to them, I was able to define patterns for the initial 15 categories and have them assigned instantaneously. Another nice feature of this is that as cards are released, they too will automatically be categorized using this algorithm. This saves me from spending extra time categorizing whenever there are new releases. With the Nightmare Decks releasing at an accelerated pace, this is all the more important.

CramThis brings us to how the text analysis itself is performed. Unlike stats, keyword and traits, categories are a bit fuzzier of a concept. As a bear, I love anything fuzzy, but it is a bit harder to convince a computer of this. Take a category like Readying, for example. A card like Cram says “ready attached hero”, while Grim Resolve says “Ready all characters in play”, and Ever Vigilant says “ready 1 ally card”. While they are all worded differently, and have slightly different effects, they all represent a card that provides readying to a deck. The concept of a category would be far less useful if each of these cards was assigned a different category, so the goal will be to create groupings these kinds of similar cards.

This is where regular expressions come to the rescue. For those interested in software design, language theory, or automata, regular expressions are a fascinating subject worthy of their own study. For everyone else, it is enough to say that regular expressions are a kind of language that is used to analyze text for particular words and phrases. By defining more general patterns for each category, we can recognize the common thread that connects Cram, Grim Resolve, Ever Vigilant and other cards like them. By creating enough of these patterns, we can categorize most of the player cards in the game automatically, and spare my poor paws from the pain of doing everything manually.

As much as the categories themselves are objectively based on the words and phrases in question, the decision of which categories to create is of course a subjective one. The goal is for categories to serve as aids in deck-building – especially when it comes to suggesting cards that might otherwise go overlooked. With that in mind, they should provide real utility to the community as a whole, and not just be organization for its own sake.

So if anyone has suggestions for new categories please leave them in the comments below. I want to keep the categories to a manageable number, so I cannot promise that I will add every suggestion, but I will certainly give them their due consideration. Lastly, the patterns that I am using are incomplete, and some cards are not currently categorized. For anyone who enjoys using their red marker, and wants to spot check the categories to suggest cards that need to be included, that would be most appreciated.

Without further ado, here are the current categories, along with a few examples of the kinds of phrases that they match:

Category Matches
Resource Acceleration “Add 1 resource”, “Add 2 resources”
Resource Smoothing “Move 1 resource”, “Pay 1 resource from a hero’s resource pool to add 1 resource”
Ally Mustering “ally into play”, “allies into play”
Willpower Bonus “+1 Willpower”, “+2 Willpower”
Attack Bonus “+1 Attack”, “+2 Attack”
Defense Bonus “+1 Defense”, “+2 Defense”
Hit Point Bonus “+1 Hit Point”, “+4 Hit Points”
Card Draw “draw 1 card”, “draw 3 cards”
Card Search “search your deck”
Player Scrying “looks at the top 5 cards of his deck”
Encounter Scrying “look at the top card of the encounter deck”
Combat Control “enemy cannot attack”, “enemies cannot attack”
Healing “heal 1 damage”, “heal 2 damage”, “heal all damage”
Readying “ready all characters”, “ready attached hero”, “ready him”, “ready 1 ally”
Recursion “return 1 spirit card from your discard pile”, “shuffle your discard pile”
Direct Damage “deal 1 damage”, “deal X damage”, “deal damage to the attacking enemy”, “excess damage dealt by this attack”
Encounter Control “deal 1 damage to each enemy as it is revealed by the encounter deck”, “cancel the ‘when revealed’ effects”
Shadow Control “cancel a shadow effect”, “look at 1 shadow card”, “cancel any shadow effects”
Location Control “place 2 progress”, “switch the active location”, “location enters play”
Threat Control “reduce 1 players threat”, “lower your threat by 2”, “reduce your threat to your starting threat level”
Staging Area Attack “target enemies in the staging area”, “against an enemy in the staging area”
Staging Area Control “that enemy does not contribute its Threat”, “that location does not contribute its Threat”, “Choose an enemy in the staging area”
Enters Play “After Son of Arnor enters play”, “After Snowbourn Scout enters play”
Leaves Play “after Descendant of Thorondor enters or leaves play”, “after an ally leaves play”
Played From Hand “after you play Rivendell Minstrel from your hand”, “After you play a Dwarf character from your hand, draw 1 card”
This entry was posted in Community, Deck Building, Fun, Hall of Beorn Card Search, Software and tagged , , , , , , , . Bookmark the permalink.

26 Responses to Bear With Me: Text Analysis

  1. Jan says:

    hi Beorn, you double “Location Control” .. your changes to your card search are awesome!

  2. What language are you writing the server-side in? If I know it, I might be able to help out a bit.

  3. gaudyls says:

    Shadow of the past, I think that this card is a sort of encounter control. Have you considered this?

    Thanks

  4. Luis Fernández says:

    The end comes, then, must go in the same group, Encounter control, avoiding the cards that are in the deck mixing with the discard pile if you know that what is there is worst (a very poor card, only I would consider use this card abusing Denethor, but Denthor with Dwarves…)

    • Beorn says:

      Maybe? Shuffling the encounter discard pile into the encounter deck just seems so random. Unless all of the cards in the discard are of one type, you are not changing the odds of encounter deck enough to warrant calling it “control”. This is my whole issue with The End Comes, it just seems too random of an effect to warrant including in a deck.

  5. scwont says:

    This is a fantastic resource! I’ve already started putting it to practical use.

    A couple of small suggestions:
    – list the categories in alphabetical order in the dropdown list to make them a bit easier to find
    – “Leaves Play” mostly includes characters leaving play but also things like locations leaving play, which don’t really fit together.

  6. GrandSpleen says:

    Very cool.

  7. Ben says:

    Currently, “King under the mountain” is considered scrying. I think you could also put this in card draw. The RegEx might read the words “look” and “put into your hand”.

    Also was wondering if you could do a multi-select feature. So I could see all cards for ally mustering and cards for threat redux at once.

    • Beorn says:

      I will definitely be fixing King Under the Mountain in the next release. As for multi-selection, I want to add an advanced search feature that supports this, but I want to spend some time designing the right UI for this feature, so it will be a while before this is available.

  8. gaudyls says:

    About resource smoothing, I only see here cards that move resource from one hero to other. giving a sphere to a hero is not a class of resource smoothing? the Sphere Songs and Narvy’s belt, for expample I consider to be in this category.

  9. dschlanger says:

    There are 3ish cards that trigger extra bonus based on the condition that your threat is 20 or less. Noiseless Movement is one. They do not have the Secrecy keyword, but clearly work extremely well with Secrecy decks. It would make sense to include them in some sort of Secrecy category.

  10. Sechen says:

    It doesn’t actually include the phrase “Leaves Play” but the humble Keen-Eyed Took can leave play at will, and really combos with a lot of cards from that set. I’d suggest that you probably should include him in that set.

  11. Jerogah says:

    My binder has been catagorised like this from the beginning, and a lot of the categorieën match 🙂 great, now I don’t need to rely on my binder anymore!

  12. PigsAreOurEquals says:

    “Discard” would be a category especially for Noldor and dwarf miner decks.

  13. Beorn says:

    Yes, Interrogation was mis-categorized. I will fix that in my next update. As for Dwarven mining (discard from the top of your deck), it obviously needs it own category. I will look into adding that as well.

  14. Beorn says:

    Here you go:

    http://hallofbeorn.com/LotR?Category=Discard+From+Deck

    Also, Interrogation’s categories are fixed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s