In sponsored search, the ad selection algorithm is used to pick out the best candidate ads for ranking, the bid keywords of which are best matched to the user queries. Existing ad selection methods focus on the relevance between user query and selected ads (or keywords) and they sometimes fail to optimize the monetization ability of the results. Our work takes advantages of the different impacts of different components inside the keywords on both relevance and monetization ability. We extract connections between the components of queries and bid keywords to build an offline knowledge base. When a new query comes, we first select keyword components and try to maximum the relevance and revenue on the component level, and then make combination of the selected components to generate the selected bid keywords. In the experiments, we use the ad logs from a commercial search engine to evaluate our method on the recall of the keywords; we also use human judgment to test the precision of the query-keyword pairs; furthermore, we employ an offline simulation system for sponsored search to evaluate the monetization ability. The experimental results show that our method can significantly outperform the state-of-art algorithms on all the above metrics.